Using a char without pressing enter
Author |
Message |
silvershadow
|
Posted: Sat Jun 03, 2006 7:43 am Post subject: Using a char without pressing enter |
|
|
im building a simple game, but im tired of having to type in words and pressing enter to do anything. i was hoping, to just press one single keyboard button, to make something take place.
code: |
var choice : char
get choice
if choice = 'u' then
guess := 1
put "You bet under 7"
end if
|
that is not my full code, that is just a sample of it, which i shortened to help better understand my problem.
when the user has to enter their choice..they press a character, but then they have to press Enter after it in order for it to work. is it possible to edit my code so that way they wont have to press Enter? i just want the user to press the charactor and it automatically works.
thanks. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheOneTrueGod
|
Posted: Sat Jun 03, 2006 8:03 am Post subject: (No subject) |
|
|
code: |
var ch : char %Also works with strings
ch := getchar
put ch
|
|
|
|
|
|
|
silvershadow
|
Posted: Sat Jun 03, 2006 8:42 am Post subject: (No subject) |
|
|
thanks alot, really appreciate it. |
|
|
|
|
|
TheOneTrueGod
|
Posted: Sat Jun 03, 2006 9:28 am Post subject: (No subject) |
|
|
No problem, thats what the help forum is here for |
|
|
|
|
|
|
|