Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 hasch..
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TrAnCeIn4LiFe




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Thu Jun 03, 2004 2:34 pm   Post subject: (No subject)

code:

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




PostPosted: Thu Jun 03, 2004 3:54 pm   Post subject: (No subject)

you might want to flush the input buffer right after the hasch
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
SuperGenius




PostPosted: Thu Jun 03, 2004 3:56 pm   Post subject: (No subject)

what do you mean by that tony?
Tony




PostPosted: Thu Jun 03, 2004 4:08 pm   Post subject: (No 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

Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Paul




PostPosted: Thu Jun 03, 2004 4:20 pm   Post subject: (No subject)

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




PostPosted: Thu Jun 03, 2004 5:23 pm   Post subject: (No 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
SuperGenius




PostPosted: Thu Jun 03, 2004 5:27 pm   Post subject: (No subject)

i believe that input.keydown works seperate from getch.
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Jun 03, 2004 9:22 pm   Post subject: (No subject)

yes, Input.KeyDown modifies it's chars array. Getch stores input in a buffer
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: