[I7] (SOLVED) epilogue commands with variables

So I am trying to allow for a fun thing to do in the epilogue where I can let the player see all random things a person says.

while I couldn’t put this in the source code and tell the player to look there, I wanted to add a bit of user-friendliness. Here is the code I came up with, and it is terribly hacky. I think I am misunderstanding some general concepts, here.

[code]“endlist” by Andrew Schultz

room 1 is a room. “Go north.”

check going north in room 1:
end the story finally.

Table of Final Question Options (continued)
final question wording only if victorious topic final response rule final response activity
“” true “LIST” – textlisting [“LIST [number]” or “LIST” doesn’t work…]
“see random text lists” true “LIST [number]” – textlisting
[“try this which doesn’t work” true “TXT [number]” – txtlisting]

textlisting is an activity.

rule for textlisting:
if the number of words in the player’s command is 1:
say “1 = Bob’s random sayings[line break]2 = Mac’s random sayings[line break]3 = Bub’s random sayings[line break]4 = Gus’s random sayings[line break]5 = Joe’s random sayings[line break]”;
if the number understood > 5:
say “Number can be from 1 to 5.”;
say “[the player’s command].”;

txtlisting something is an activity on numbers.

rule for txtlisting a number (called N):
if N is 0:
say “Fill in #s to use laterListing.”;
say “List # N.”;[/code]

what I want to be doing is to allow the player to say LIST to see all the things he can list, then LIST 1 or whatever. This creates several problems.

  • I can’t use the “LIST” or “LIST [number]” token for the topic entry, so I have to deal with an extra space.
  • even if I could get a number, txtlistng (a rule applying to something) does not work as a rule, as in the commented out code. A workaround would be to “LIST [text]” and see if the player’s command matches Joe, Bob, or whatever. That feels rickety, though.

I have a feeling I’m missing something structural, and right now, I’ve hit a wall. Can anybody explain to me what I should be doing, and–if it’s helpful–why?


I think the problem is that at that point the parser isn’t doing anything, the final question is handled by “reading the player’s command” rules. You might try something like this:

Understand "list" as "[list]". Understand "list [number]" as "[list]".

Then use “[list]” as the topic entry.

This seems like it should work, but Inform gives this error, which confuses me, since both ways seem to produce “a thing.”:

You wrote ‘understand “list [number]” as “[list]”’ : but grammar tokens must have the same outcome whatever the way they are reached, so writing a line like 'Understand “within” or “next to [something]” as “[my token]” must be wrong: one way it produces a thing, the other way it doesn’t.

Ah. If I understand correctly it’s saying that it can’t accept both “list [number]” and “list” as “[list]”, because if the player just typed “list” there would be no “number understood”.

Ah, thanks.

Actually, the right code was something simple, and it’s something I thought I tried.

[code]Table of Final Question Options (continued)
final question wording only if victorious topic final response rule final response activity
“List things (1-20)” true “list [number]” – listing specific possibility
– true “list” – listing all possibilities

listing all possibilities is an activity.
listing specific possibility is an activity.

rule for listing all possibilities:
say “1. books[line break]2. textbook blather”;

rule for listing specific possibility:
let N be the number understood;
say “[N].”;[/code]

For some reason, I thought the “number understood” needed to be linked with an activity on a number. But it does not.