Computer Science Canada

hasch..

Author:  TrAnCeIn4LiFe [ Thu Jun 03, 2004 12:54 pm ]
Post subject:  hasch..

yah i was wondering if sombody could give me like example of hasch statment ill looking at this one writen dunno but no clue how to use it teacher never thought us Sad

Author:  Paul [ Thu Jun 03, 2004 2:34 pm ]
Post subject: 

code:

put "Press anykey to exit"
loop
if hasch then
exit
end if
end loop

Author:  Tony [ Thu Jun 03, 2004 3:54 pm ]
Post subject: 

you might want to flush the input buffer right after the hasch

Author:  SuperGenius [ Thu Jun 03, 2004 3:56 pm ]
Post subject: 

what do you mean by that tony?

Author:  Tony [ Thu Jun 03, 2004 4:08 pm ]
Post subject: 

i mean use getch to get rid of buffered input, because otherwise the hasch will continue to return true and would skip any next menu
code:

%bad
put "Press anykey to exit"
loop
    if hasch then
        exit
    end if
end loop

put "don't press anything"
loop
    if hasch then
        exit
    end if
end loop
put "i told you not to press anything"


It is often useful to have a flush function run right before any "press any key to continue" message.

code:

procedure flush
    var c : string (1)
    loop
        exit when not hasch
        getch (c)
    end loop
end flush


Author:  Paul [ Thu Jun 03, 2004 4:20 pm ]
Post subject: 

oh yea, forgot about that... so thats why some of my hasch's haven't been working.

Author:  TrAnCeIn4LiFe [ Thu Jun 03, 2004 5:23 pm ]
Post subject: 

hum, got it but one quick question i'm running the game and it wont exit when i use hasch comand why...? is it cuz of all the input keydowns or ??
Sad

Author:  SuperGenius [ Thu Jun 03, 2004 5:27 pm ]
Post subject: 

i believe that input.keydown works seperate from getch.

Author:  Tony [ Thu Jun 03, 2004 9:22 pm ]
Post subject: 

yes, Input.KeyDown modifies it's chars array. Getch stores input in a buffer


: