Word

From AGI Wiki
Jump to: navigation, search

This data type refers to an array of numbers and a matching array of text entries that correspond to the parsed list of words that are typed by a player. Word values are represented in source code by the letter 'w' and their index (i.e. w1, w2, etc.)

This data type should not be confused with the vocabulary words list that is provided in the WORDS.TOK resource file, although it is related. The parser puts the text of each parsed word in the word text array and compares them to the words in WORDS.TOK. The word number array is filled with the numbers that correspond to entries in the WORDS.TOK file. The words number data array is used internally by the interpreter when the said command is processed. Arguments in the said command are compared against the numbers in the words array to determine if player input matches.

The words data arrays are filled by the interpreter's parser each time the player presses the enter key. The arrays can hold up to 10 words; if more than 10 are entered, only the first 10 are kept; the rest are discarded. In AGI commands, word values are referenced by their index, with the first word being index 0, the second being index 1, etc. This is somewhat confusing, since the print command format code for words starts with the first word being "w1", not "w0". (WinAGI handles this by requiring word arguments to be 'one-based', and then converts them to 'zero-based' on compilation, to maintain consistency with the print command format codes.)

Data types