The 'prompt' statement in sucros has the general form (all lines are starting
by '-' in the control column):
- prompt <Question text ?> {}
- default <default answer, text or tutstack word>
- answer <name of tutstack word for the answer (optional)>
- length <max. length of the answer>
- wait <max. waiting time in 0.1 seconds, integer or tutstack word>
The prompt line displays the text intended as a question.
The optional answer line gives the place of the answer in the tutstack.
If the answer line is missing, the answer is appended as the last word
to the tutstack.
If the user gives no answer, the sucro waits until the time qiven on
the wait line is over and accepts the default answer which also can
be a tutstack word.
Although the question and the answer are displayed on the screen in
the current context of the edit field, they are not permanently written
into the edit field.
The prompt can be interrupted by the ESC key. Then the text '(break)'
will appear as an answer.
Example:
This part of a sucro prompts the user to give his/her age and writes
a sentence as a comment of the answer.
12 - prompt Your age ? / question
13 - default 0 / default answer
14 - answer W1 / place for the answer
15 - length 3 / length of the answer
16 - wait 1000 / max. waiting time
17 - if W1 < 3 then goto Too_young / comparing answer W1
18 - if W1 > 99 then goto Too_old / with 3 and 99
19 *{R}
20 *Your age is {print W1}.{goto End} / displaying answer
21 + Too_young: {R}
22 *Are you so young really?{goto End}
23 + Too_old: {R}
24 *Hard to believe that you are so old!
25 + End: {end}
U = More information on user interaction
C = Code words and statements in sucros