How to listen for input while paused?

Use this section to showcase your programming examples. Or to ask members for programming suggestions
Post Reply
okto
Posts: 59
Joined: Sun Apr 23, 2023 5:14 am

How to listen for input while paused?

Post by okto »

I want to have a message display for either a set amount of time using PAUSE or to be dismissed by key input before the PAUSE time has elapsed.

How do I do this?
User avatar
Martin
Global Admin
Posts: 220
Joined: Mon Jan 02, 2023 5:18 pm

How to listen for input while paused?

Post by Martin »

Hi Okto

PAUSE
Syntax: PAUSE x%

Pauses the program according to the value of x%:

0 Waits for a key to be pressed.
<0 Pauses for x% (made positive) twentieths of a second or until a key is pressed.
>0 Pauses for x% twentieths of a second.
So PAUSE 100 would cause the program to pause for five seconds. In the first two cases, the key pressed is stored in a buffer and it is wise to remove it with the KEY function:

Code: Select all

<statement list>
PAUSE 0
KEY
<statement list>
The keypress stored in the buffer from the PAUSE 0 command is taken as the input for KEY.

Also (but not in the manual) if you want to 'use' the keypress then put in in a variable for example i%=KEY

In good faith Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reference page 82 of the republished Organiser Programming Manual (here)
okto
Posts: 59
Joined: Sun Apr 23, 2023 5:14 am

Re: How to listen for input while paused?

Post by okto »

Perfect, thank you!
Post Reply