Test Commands / Mathematical Commands
if (said("word1","word2"...."wordn")) { ....
The said test command is different to all other commands in the language in that it accepts a special type of parameter and can have any number of parameters. It is used to test if the player has entered certain words.
First, the process of parsing player input needs to be explained. When the player enters a command, the interpreter does the following things with it:
Note: The above is based purely on observation. I am not sure if the interpreter does exactly this, or in this order.
Once the player input has been received, flag 2 (input_recieved in the template game) is set and flag 4 (input_parsed in the template game) is reset.
When the said test command is used, it goes through each word given as a parameter and compares it with the corresponding word entered by the player. If they are the same (or are in the same word group), then it continues onto the next word. The comparison is not case sensitive. If all the words are the same, and there are no entered words left over, then the said command returns true and sets flag 4.
There are a couple of special word groups:
Word group 1: "anyword" - if this word is given as a parameter, then any word will do. So if you test for said("eat
","anyword
") then the result will be true if the
player enters "eat cake", "eat chocolate", "eat worm", "eat sword", etc.
Word group 9999: "rol" (rest of line) - this means the rest of the line. If you test for said("kill
","rol
") then the result will be true if the player enters "kill
lion", "kill lion with sword", etc.