
-----------------------------------
Tubs
Fri Jun 06, 2003 11:33 am

Forking quit
-----------------------------------
How can i set my program so that if the ESC button is pressed, it will close the window?

var Choice : string

process Exit
  if Choice = KEY_ESC then
    quit
  end if
end Exit

fork Exit

for I : 1..10
  delay (100)
  put I
end for

doesnt work cause i suck at turing

-----------------------------------
PaddyLong
Fri Jun 06, 2003 11:54 am


-----------------------------------
it doesn't appear that you are actually getting any input for Choice

do something like


if hasch then
   getch (Choice)
end if


put that into your Exit process before your if Choice = KEY_ESC ..

but for that to work you'd need to make Choice declared as 

var Choice : string (1)


also, if the only input you're going to be getting for Choice is to see whether to quit or not in the Exit process, you might as well make it a local variable to Exit (so just declare your var Choice : string (1) inside of the Exit process)

-----------------------------------
Tubs
Fri Jun 06, 2003 12:11 pm


-----------------------------------
process Exit 
  var Choice : string (1)
  if hasch then 
    getch (Choice) 
  end if 
  if Choice = KEY_ESC then 
    quit 
  end if 
end Exit 

fork Exit 

for I : 1..10 
  delay (100) 
  put I 
end for 

ya still doesnt work, cuase i am dumb

-----------------------------------
Tony
Fri Jun 06, 2003 12:45 pm


-----------------------------------
you forgot the loop  :lol:

-----------------------------------
Martin
Fri Jun 06, 2003 1:52 pm


-----------------------------------
process Exit
  loop
    if Choice = KEY_ESC then
      quit
    end if
  end loop
end Exit

A process still runs like a procedure, so when its end is reached, it will stop.

-----------------------------------
PaddyLong
Sat Jun 07, 2003 7:03 pm


-----------------------------------

process Exit
    var Choice : string (1)
    loop
        if hasch then
            getch (Choice)
            if Choice = KEY_ESC then
                quit
            end if
        end if
    end loop
end Exit

fork Exit

for I : 1 .. 10
    delay (100)
    put I
end for


-----------------------------------
Andy
Sat Jun 07, 2003 7:11 pm


-----------------------------------
if u suck at turing, then why is ur rank programmer?

-----------------------------------
PaddyLong
Sat Jun 07, 2003 7:23 pm


-----------------------------------
you are a very obnoxious individual dodge_tomahawk.  you should learn a bit of modesty.   :roll:

-----------------------------------
Andy
Sat Jun 07, 2003 7:55 pm


-----------------------------------
hmmm, why?

-----------------------------------
void
Sun Jun 08, 2003 10:36 am


-----------------------------------
dodge_tomahawk.. dun worry man...Paddy is just on crack...theres no sympathy for stupidity...but being a programmer isnt a rank that you earn..its just one of those usergroups that you join..or atleast that how i got in..**laughs maniacly** (spell. error)

-----------------------------------
Tubs
Tue Jun 10, 2003 11:57 am


-----------------------------------
if u suck at turing, then why is ur rank programmer?

i dont actually suck i just diss myself a lot

-----------------------------------
Blade
Tue Jun 10, 2003 12:33 pm


-----------------------------------
heh... you dont join usergroups to get yer rank to change... mine hasnt changed yet. im actually a "kick ass hacker" it shows in my profile thing.. just not in my posts. it depends on how many posts you get... thats how it changes... *shakes head*

-----------------------------------
Andy
Tue Jun 10, 2003 5:48 pm


-----------------------------------
ya... lots of ranks dun show for some reason, i wanna my newbe hacker to show :cry:

-----------------------------------
Tony
Tue Jun 10, 2003 7:48 pm


-----------------------------------
dodge, you dont deserve your newbe hacker. If anything, I'm gonna assign 1337 spammer to you, cuz thats what you do  best :lol:

-----------------------------------
Tubs
Wed Jun 11, 2003 11:09 am


-----------------------------------
well this weird shit....

process Exit
    var Choice : string (1)

    loop
    drawfillbox (1, maxy - 15, 70, maxy, 12)
            Font.Draw ("ESC to Quit", 2, maxy - 10, font1, blue)
    delay (1000)

        if hasch then
            getch (Choice)
            if Choice = KEY_ESC then
                quit
            end if
        end if
    end loop
end Exit

fork Exit
Start
fork Exit

when i remove the drawing command for quit it doesnt work, but if its not there it works

-----------------------------------
Tubs
Wed Jun 11, 2003 11:11 am


-----------------------------------
nevermind it doesnt work anyways, any ideas
