Comparing I7 commands to a table value

I want to have a table, something like this:

Table of Introduction Tutorial Commands verb noun second command toggle "inventory" "" "" "try INVENTORY" 0 "examine" "me" "" "try EXAMINE ME" 0 "examine" "*" "" "try EXAMINE DESK or EXAMINE CLOCK" 0 "polish" "clock" "rag" "try POLISH CLOCK WITH RAG" 0 "listen" "" "" "try LISTEN" 0

The idea is that there will be some code running during a scene that will determine the next available tutorial command to display to the user. If the user types a command that “equals” the one in the table, it gets switched off and the next one is shown, until there are no more tutorial commands to show.

I was thinking in I6 terms with this table, so forgive me if I’m not sure where to go with this…but the idea is that I should be able to have specific commands like “examine me” or “x me” equate to a single tutorial item and generic commands like “examine {something}” as another command.

If someone could lead me in the proper direction, I’d appreciate it…

David C.

I’m not an expert here, but if you want to catch successfully parsed commands (as opposed responding to fragmentary commands like “x gjlkj”), then I’d do it in terms of stored actions rather than trying to catch bits of the player’s command. So instead of having “examine me” and “x me” and “look at me” and probably a few other things equate to one of the tutorial items, you’d have the action of examining yourself equate to one of the tutorial items.

Section 12.20 of Writing with Inform tells you more of what to do here. To catch a generic examining action rather than a specific action of examining the box or whatever, you can winkle out the action name part of the current action and test that. So I’ve got this to work in a simple case:

[code]Table of Test commands
complete action action name response
the action of examining the wizard’s box – “Congratulations!”
– the examining action “Why not try examining the box?”

Before:
if the current action is a complete action listed in the table of test commands:
say the response entry;
otherwise if the action name part of the current action is an action name listed in the table of test commands:
say the response entry. [/code]

You can also break out the noun and second noun parts if you like, and could probably work up more complicated tests if you wanted to test for things like giving something to Jordan (where you have to match the action name and second noun but the noun can be anything).

(Also: As usual, I’m posting above my competence here. There may be problems lurking.)

Also, this has to work in 5Z.

Does it fail? It’s been a while since I used 5Z, so I don’t remember whether there are any relevant changes.

Problem. In the sentence ‘if the action name part of the current action is an action name listed in the table of test commands begin’ , it looks as if you intend ‘action name part of the current action is an action name listed in the table of test commands’ to be a condition, but that would mean applying the incorporation relation (between an object and an object) to kinds of value which do not fit - the name of a column and an object - so this must be incorrect.

Looks like in 5Z you need to write “the action-name part of the current action,” with a hyphen. Also, it was probably a very bad idea to use “action name” as the name of the column, as it makes further confusion possible.

Yeah, I figured out the hyphen issue…I think I know what to do from here…(fingers crossed)

David C.

And the result is…

[code]Shadow Tutorial by Textfyre begins here.

TutorialOnSwitching is an action out of world.
TutorialOffSwitching is an action out of world.
Understand “tutorial on” as TutorialOnSwitching.
Understand “tutorial off” as TutorialOffSwitching.

Tutorial Switch is a number that varies.
Tutorial Command is text that varies.

When play begins:
change the tutorial switch to 1;
change the tutorial command to “”.

Report TutorialOnSwitching:
say “Tutorial is on.”;
change the tutorial switch to 1.

Report TutorialOffSwitching:
say “Tutorial is off.”;
change the tutorial switch to 0.

When play begins:
print the next tutorial command.

Every turn during the introduction:
if the tutorial switch is 1:
if the current action is a complete action listed in the Table of Introduction Commands:
if learned entry is 0:
choose row with complete action of the current action in the Table of Introduction Commands;
change learned entry to 1;
otherwise:
if the action-name part of the current action is a player action listed in the Table of Introduction Commands:
if learned entry is 0:
choose row with player action of the action-name part of the current action in the Table of Introduction Commands;
change learned entry to 1;
print the next tutorial command.

To print the next tutorial command:
if there is a learned of 0 in the Table of Introduction Commands:
choose row with learned of 0 in the Table of Introduction Commands;
if learned entry is 0:
say response entry.

Table of Introduction Commands
complete action player action response learned
the action of examining the player – “try EXAMINE ME or X ME” 0
– the examining action “try EXAMINE DESK OR EXAMINE CLOCK” 0
– the polishing it with action “try POLISH CLOCK WITH RAG” 0
– the listening to action “try LISTEN” 0

Shadow Tutorial ends here.
[/code]