Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - wait wait for key press while displaying a prompt http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 wait                Wait for key press while displaying a prompt
------------------------------------------------------------------------------
 Syntax
   wait [cPrompt] [to cVar]

 Arguments
   cPrompt is a prompt to display while waiting for input.
   cVar is a string variable that receives input.

 Description
   The wait command displays an optional or default prompt and allows for
   character input assigned to a character variable. wait accepts one
   key from the keyboard.

   A carriage return is printed before the prompt and/or keyboard input
   unless the variable __cr_first is set to .f.. The carriage return and
   optional or default prompt are displayed through the same I/O system as
   the ? command.

   If cPrompt is specified, then it will replace the default prompt.
   Otherwise, the message "Press any key to continue..." will be displayed.

   If to cVar is defined, then wait will assign the keystroke to cVar,
   unless the pressed key is Escape. If either Enter, Tab or Backspace keys
   terminate the wait command, their ASCII values are placed in cVar.

 Example
   #define EXAMPLE_IO
   #include example.hdr

   proc Test_wait
   vardef
      char cInput
   enddef
   // pause to see if the user chooses to continue
   wait "Do you wish to continue? " to cInput
   if cInput $ "Yy"
      ? "Yes"
   else
      ? "No"
   endif
   // pause the program without echoing to the screen
   set console off
   wait
   endproc

   proc main
   Test_wait()
   endproc

See Also: accept getkey() input waitkey() waitproc()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson