News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

WAITKEY causes program to skip name entry!

Started by Mikemc, July 18, 2010, 05:43:25 AM

Previous topic - Next topic

Mikemc

If I have StaticInput anywhere after a waitkey, the key-press from waitkey carries over to the Input, bypassing it. At the same time if I have a Waitkey after the Input, it gets skipped!


#Include "Input"

print "Press a key to continue. You should then be asked your name."
print "However, if you press ENTER the program will mysteriously end."
sync
waitkey
; Request the player enter their name
Name$=StaticInput("Please type your name then confirm with anything except ENTER: ")
print "If you can read this, count to 30 then press a key."
sync
waitkey
end


*Edit
Ok, I tried adding a WaitNoKey after the first WaitKey but pressing Enter here skips the Name entry.
This is getting overly complex for some simple wait commands! I mean seriously, a DOS batch file uses 'pause' and 'choice' with no errors.

Laskiapina

You could just change "waitkey" line to "waitkey: flushkeys".
Finished projects so far: Kumiankka, Meals of the Dragon, Fisut, Draw Old, Reikäkopio, Blindage, Escape from Millmier

Homepage: Not yet named project