I am attempting to compare a player’s command to a table of possible items. I tried reading about reading a command and snippets, but I’m still unsure why I can’t try to check if the player’s command matches some text in a table. Can someone help explain that and give an example of what it takes to “convert” one into the other for the purpose of being able to compare them? My example not working code is:
[...prior stuff above...]
now the suspect-prompt is true;
now the command prompt is "Who did it? >";
Table of Suspects
who
"Professor Plum"
"Mrs. White"
"Mr. Green"
"Mrs. Peacock"
"Miss Scarlet"
"Colnel Mustard"
Last after reading a command when suspect-prompt is true:
repeat through Table of Suspects:
if the player's command matches the who entry:
say "And might I ask where [who entry] did the deed?";
now the suspect-prompt is false;
now the where-prompt is true;
now the command prompt is "Where did [who entry] do it? >";
[...other stuff to follow...]
Now, I realize there are other things wrong with this code from a finished game perspective (the command will be an unrecognized verb for one) but these are all things to take care of later if I get the current problem resolved first. I also realize this may not be the optimal way to do what this code seems to be built to do in the first place… but the point of my current question is really to ask how to compare the player’s command to the record in the table. As long as that is answered, additional critique and advice is gladly welcome. As always, this is not a real game (obviously it references “Clue”, but I mean this is not meant to ever be a real Inform IF game), but is just an exercise for me to learn from.