Slight GET KEY Variation

I can't seem to find out how to allow the user to type into the program, without completely pausing the program. I was wondering if you use a variant command of GET KEY, or if there is a special coding sequence after the GET KEY command.

Comments

re: GET KEY

The variation you can use is KEY INPUT. For example if you wanted an escape option within your program but only if the Esc key is pressed you might include

IF KEY INPUT THEN
GET KEY d
IF d = 27 then STOP
end if

If the program itself is running a loop of any kind, then this segment would be encountered each time through, but other things could be executed in the meantime. If you want several exit points, make the above a subroutine and call it whereever you want to allow an exit. There are probably 'slicker' ways, but this works. You probably should be in a loop for this method to work well.

A similar example would be something I use often. I want to pause a program (to allow for an instructor to explain what just happened or what will happen) at which time I display a small 'P' icon (paused) with the following:

do
if key input then
get key d
if d= 27 then
stop
else
exit do
end if
end if
loop

which loops until it sees a keypress then tests to see if the user wants out of the program (the Esc key) but otherwise just moves on. I usually also have a mouse test within the do loop so a mouse click can also exit the pause.

rwt

Thank you very much

This is a great help, and will work great in my game. I will probably take a month or two to make it, but I will finish it, which I couldn't have done without this. Once again, tahnk you.