The available commands are 

MESSAGE <string>
GETKEY <string1> <string2>
INPUT %reply <window_length> <field_length> <suggestion>
ASK <question> %reply <window_length> <field_length> <suggestion>

MESSAGE is used for sending data to the local screen;
GETKEY and INPUT are for receiving data from the local
keyboard; ASK is for sending data to the screen and then
waiting for a response from the keyboard.

All output begins at current cursor position within the
current box unless no boxes have been opened in which case
output is to the default Scripta window.

The action of the MESSAGE command is best demonstrated by
example:

%a := 10
%b := 14
%result := %a + %b
Message "The sum of %a and %b is %result."

This script would display the message

        The sum of 10 and 14 is 24.

Note that up to ten elements may be displayed by a MESSAGE
command but care needs to be exercised when expressions
are to be used. e.g.,

%a := 10
%b := 14
Message "The sum of %a and %b is " %a+%b "."

would display the message

         The sum of 10 and 14 is 10+14.

The values of %a and %b would be substituted but Scripta
has no way of knowing that %a+%b is meant to be treated as
an expression.

You can force an ENTIRE ELEMENT to be treated as an
expression by enclosing it in parentheses. e.g.,

%a := 10
%b := 14
Message "The sum of %a and %b is " (%a+%b) "."

would display the message

         The sum of 10 and 14 is 24.

But please see the further notes below - expressions and
subscripts are evaluated at the second substitution stage.
i.e., when the command is EXECUTED, not when it is
INTERPRETED.

Another thing to remember with MESSAGE is that normally
it will translate control characters into their single
character equivalents. For example,

             Message "#131^M^J"

outputs Ascii character 131 followed by a Carriage Return
character and then a Line Feed character.

To suppress this translation, insert a | character at the
start of the element. e.g.,

             Message  "|#131^M^J" #131^M^J

outputs the eight characters #, 1, 3, 1, ^, M, ^, J,
followed by Ascii character 131 and then a Carriage Return
followed by a Line Feed.

One final thing to remember is the way in which Scripta
substitutes variable VALUES wherever a variable name
appears in a command parameter list.

This substitution occurs twice - once when the command is
first interpreted and then, for some commands, a further
substitution takes place when the command is actually
executed. This second substitution will evaluate
expressions and recognise string variable subscripts. The
most common places in which this second substitution occurs
are in the MESSAGE command, for evaluating subscripts and
expressions, and within FUNCTIONS used in expressions.

This second substitution may be used to great effect and,
by judicious use of % characters, the first substitution
can be suppressed.

It must be remembered that the first substitution is a
simple replacement of variable NAMES with variable VALUES.

This means that subscripting may not be used to extract
substrings of strings.

          %a := "abcdefghijk"
          MESSAGE "%a[2,3]"

would display the value abcdefghijk[2,3]

If you enclose the parameter in parentheses, to make it an
expression,

          MESSAGE ("%a[2,3]")

it gets translated by the first substitution into
(abcdefghijk[2,3]) which will then fail the second
substitution because it represents an invalid expression.

The solution is to use two % characters:

          MESSAGE ("%%a[2,3]")

The first substitution finds two adjacent % characters so
by normal Scripta syntax rules, there is no variable name
here. One of the % characters is deleted leaving

          MESSAGE ("%a[2,3]")

The second substitution then correctly recognises the
variable and its subscripts so the actual message
displayed becomes

          cde

i.e., three characters starting with character 2 of the
value of %a.

The GETKEY command returns the next key from the keyboard
buffer. If no key has been pressed, the command waits
until one has been pressed. The status of the keyboard
buffer may be tested using the conditional commands

          IF/UNLESS/WHILE/UNTIL KEYPRESSED
                                NOKEYPRESSED
                                %Press
                                %NoPress

If the pressed key is an extended Ascii key then string1
will have length zero and string2 will contain the
extended Ascii character. Otherwise, string1 will contain
the 'ordinary' Ascii character.

For example, if the key pressed is 'A' then string1 will
be equal to 'A' and the value of string2 is irrelevant. If
the key pressed was the PgDn key then string1 will have
length zero and string2 will have the value Ascii 81. A
complete list of Ascii and extended Ascii codes is
probably given in your DOS manual.

The cursor may be on or off when GETKEY is executed. GETKEY
does not change the state of the cursor.

The INPUT command fetches a whole string of data from the
keyboard.

It opens a frameless window in the current box, starting
at current cursor position and of length <window_length>.
This INPUT window always has the colours 'White on Black'.
The maximum length of acceptable replies is specified by
<field_length>, which may be longer (but not shorter) than
<window_length>. If the user attempts to type beyond the
end of <window_length> then the displayed value scrolls
left so that only part of the value remains visible within
<window_length> characters of screen space.

If <suggestion> is supplied then this is displayed to the
user as a suggested reply. i.e., it is displayed as the
initial field contents. Otherwise, the field is left
blank.

The user may use any of the standard data input keys:
Home, End, Ctrl/End, CursorLeft, CursorRight, Del,
Backspace and Insert.

The INPUT command always switches on the cursor when it
is executed and switches it off again when it finishes.
Therefore, if you require the cursor to be visible following
an INPUT command, you must switch it on explicitly using
the command CURON.

ASK is similar to INPUT except that a VISIBLE window is
opened, using the current window colours set by BOXHUES,
of just the right length to contain <question> and
<window_length>. The question is displayed using current
text and background colours, user-typed input, whether
using ASK or INPUT, is always White on Black.

<suggestion> has the same usage as the <suggestion>
parameter used by the INPUT command.
