2.6 Process of parsing player input (from AGDS docs)
Last updated: 31 August 1997
NOTE: This is taken from the description of the said command
from section 4.3
Here is how the input is matched. After the player types a
message and presses Enter, the input line is processed by the
interpreter.
- Interpreter removes all punctuation marks.
- All characters are converted to lowercase.
- All sequences of more than one space are replaced with a
single space.
- Starting with the first word of the input, the
interpreter looks up the vocabulary, trying to find the
longest character sequence matching the entered.
If the search is unsuccessful, Var(9) is assigned the number
of
the word in the message that failed to match and the processing
ends. If all the words have been assigned some codes:
- The Interpreter removes from the sequence of codes all
zeros (that means all vocabulary words with zero codes
are ignored).
- Flag(2) (the user has entered an input line) is set to 1
- Flag(4) (`said' command accepted the user input) is set
to 0.
If the sequence of code produced by the interpreter is
V(1), V(2),...V(m).
The test is performed as follows:
If Flag(2) = 0 or Flag(4) = 1, return FALSE.
Compare parameters W(i) and codes V(i) as follows:
- if W(i) = 1, it matches any V(i);
- if W(i) = 9999, it matches the whole remaining input i.e.
the codes V(i), V(i+1),...V(m).
Otherwise W(i) should be equal to V(i).
If all elements match, Flag(4) (`said' accepted the user
input) is set to
1 and the command returns TRUE. Otherwise, FALSE is returned.