Parse

From AGI Wiki
Jump to: navigation, search

The parse command parses a string as if it were text entered by the player.

Syntax

parse(str sA);

Remarks

AGI treats the text of string sA exactly the same as player entered text. Reserved flags f2 (input received) and f4 (said found match) are reset to FALSE. String sA is parsed, and if all words are valid reserved flag f2 (input received) is set to TRUE. If an unknown word is encountered, reserved variable v9 (invalid word number) is assigned the sequence number of the word in the message that failed to match and the processing ends.

Possible Errors

If an invalid string number greater is passed to the parse command, it is ignored and the parse command exits without doing anything. Also, in AGI versions that allocate space for 24 strings, only the first 12 strings (s0 - s11) can be parsed with the parse command; the command does nothing if strings s12 - s23 are passed. This appears to be a bug that Sierra never noticed or fixed.

Example

Code:
s5 = "look tree"; 
parse(s5); [ same effect as if the player typed "look tree" on the input line

Technical Information

Required Interpreter Version: Available in all AGI versions.
Byte-Code Value: 117 (0x75 hex)

See Also

String Commands