( Basic4GL 2.4.7 )
ClearKeys - clear the keyboard buffer.
ClearKeys() clears the keyboard buffer. It is useful if you want to make sure that the player isn't pressing a key.
Clearing Between "Screens"
If you have one "screen" and have one button to advance, you can use ClearKeys() to keep the player from skipping screens.
TextMode(TEXT_BUFFERED) Do Cls Printr "Screen 1." Printr "Press space to continue." DrawText() Sleep(1) Loop Until ScanKeyDown(vk_space) ClearKeys() Do Cls Printr "Screen 2." Printr "Press space to continue." DrawText() Sleep(1) Loop Until ScanKeyDown(vk_space) Cls DrawText()
Clearing Before Input
Using ClearKeys() before Input ensures that the input line appear empty. This is especially useful if there is a delay before Input.
Dim answer$ Printr "Type something during the delay." Sleep(2000) ClearKeys() Input " > ", answer$ End
This page has been recommended for cleanup, integration, etc.