KEY 3 SHOW3 ; Branch to „SHOW3“ in the case of key 3
(any instruction) ; Continue if the user
(any instruction) ; does not press a key within 10 seconds
In this example, the program „waits“ 10 seconds for a key to be pressed. If a key is pressed,
the waiting time is terminated and the program takes a branch. If the key which is pressed is not ke
1, 2 or 3 or if no key is pressed, the program executes the next instruct
n .
Response to any
y :
Sometimes it may be meaningful to make the subsequent progression of the program dependen
on the fact that any key rather than a specific key has been pressed. It is possible to scan the keyb
ard buffer accordingly. In this case the question mark „?“ is used as the key sym
l .
WAIT 10; 10 s waiting
i m e KEY ? PRESS; Branch to „PRESS“ if any key is pre
s e d SHOW PICTURE 2; Otherwise show picture 2, etc., e
c.,
Try out these two special cases in an example using a problem statement of your own choice.
B-2.3 The alternative
Like most things in life, there is an alternative to the KEY instruction: the RESPONSE in-
struction. This instruction is always useful if we require user input to consist of more than one
character. The first essential difference compared with the KEY instruction is the fact that a
RESPONSE instruction interrupts the program for as long as it takes the user to key in his
input and terminate it by pressing the ENTER key (ENTER must be pressed).
KODAK S-RA2500 Editing System 1.0 User Manual Page: 53
Nevertheless, it is possible to ensure that a program will resume after a certain time rather than
wait for user input for ever and ever. The TIMEOUT instruction can be used to define the time
interval which the user is allowed as a response time in the case of the RESPONSE instruction.
The defined time applies to all RESPONSE instructions until the defined time is changed by
another TIMEOUT instruction. TIMEOUT obviously has no effect on KEY instructions.
Another important special feature of the RESPONSE instruction is its connection with the
screen. If we require the user to enter several characters we must make it possible for him to
check the characters which he keys in. It is possible to display a block of text in which a field
is filled with the symbols @@@@.... If such a block of text is on the screen when the RE-
SPONSE instruction occurs, a flashing cursor is shown in this field and the characters which
the user enters are displayed so he can check them. The user can also make corrections by
using the cursor keys if he mis-keys anything.
The following example uses these capabilities in order to ask the user a concept:
LABEL START ; Beginning of program
TIMEOUT 20; Set 20 s reply time
SHOW QUESTION; The question is shown