Using phrases connected to changing values in tables

Hello.

I got a bit stuck trying to make an action dependant on changing value in some table:

I have a conversation table, that has “turn stamp” value that changes to current turn value after asking corresponding question.

Before that, it is an empty column.

I have an item that i don’t want PC to be able to pick up when turn stamp corresponding to a question about said item is empty. So to summarise, i only want PC to be able to pick up that item after asking corresponding question.

My code looks like this:

Before taking Leather-bound tome:
	If there is a turn stamp corresponding to a topic of "book" in the Table of Torturer's Chatter:
		continue the action;
	Otherwise:
		say "I don't think that's a good idea.";
		stop the action;

I don’t get any errors, everything compiles great.
Value in table gets changed (i can see that, because there is another answer that shows up with the same topic when you ask it after the first time - and it’s also dependant on the turn stamp entry being there)
But in this case i still get “I don’t think it’s a good idea”, so the phrase goes immediately to “otherwise” for some reason.

Any ideas :)?

Can you add small example of the table itself? Maybe a shortened version. I would like to try to reproduce the behavior before trying to debug it.

Table of Torturer’s Chatter
topic reply summary turn stamp answered
“Location” “We are” “Location” a number “You are where you are”
“Himself” “I am who i am.” “Himself” – “He is who he is”
“Book” “Oh, this little thing?” “Book” – “Yes yes”

Reply is being used as first reply.
Answered is being used as replies after first (and it works - and it is dependant on there being a turn stamp value in table)

Thanks for your help :slight_smile:

Did you try using a topic of "Book" in your rule? Maybe it’s matching case-sensitively.

Also, you mention that somewhere else a check for a turn stamp is succeeding – what is the exact source text that this check uses? Is it phrased differently? Sometimes subtle differences are important.

It is phrased differently, but that’s due to different causes. Here is the code:

Instead of asking someone about something:
let the source be the conversation of the noun;
if topic understood is a topic listed in source:
if there is a turn stamp entry:
say “[The noun] has already told you that [answered entry].”;
otherwise:
now turn stamp entry is the turn count;
say “[reply entry][paragraph break]”;
otherwise:
say “[The noun] stares at you blankly. [paragraph break]You could ask [The noun] about…”;
repeat with N running from 1 to the number of rows in the conversation of the noun:
say “[summary in row N of conversation of the noun].”

As you can see, here the table is being used as a more general means - and with this phrasing IF has no problem of finding proper entry, but it’s also searching for a proper turn stamp corresponding to a topic that it also needs to choose.

In my example i need it to check turn stamp in just one topic - that i chose for it. I guess this may be a problem? And for some reason even if it finds correct table it has a problem finding proper topic?

Edit: Turning “book” to “Book” gets the same result - game skips to “Otherwise:” and shows “it’s not a good idea” response with book staying in the room.

That’s probably it then. Topic columns are a bit weird since topics aren’t exactly text – and in particular §16.13. Topic columns explicitly says that “only one operation is allowed with topic columns”, namely “listed in”. Thus the “corresponding to” is apparently excluded.

You’ll need to rephrase your original rule to use that method, eg:

Before taking the leather-bound tome:
    if "Book" is a topic listed in the Table of Torturer's Chatter:
        if there is a turn stamp entry:
            continue the action;
    say "I don't think that's a good idea.";
    stop the action.

Another option, since you have some suitable non-topic columns as well, might be to use your original phrasing but match on the summary column instead of the topic column, which is actually plain text. You could also explicitly choose the row and then ask if there’s a turn stamp entry, since you know that the row should always exist.

1 Like

Oh my god thank you very much - it was the “corresponding to topic” problem. I just changed it to use summary instead, since that is what i use to print all conversation topics.

Thank you again :slight_smile:

Indeed, this is a thing Inform’s documentation doesn’t explain very well at all!

While topics look like text strings, they’re actually a completely different thing: under the hood, they’re actually functions. When you check text against a topic, you’re actually calling the function with that text as an argument, and it returns true or false to say whether or not it matches.

Which, among other things, means topics cannot be printed, and cannot be compared against each other. The way Inform handles them (stuff in double-quotes is a topic if it’s in a table column named “topic” or in an “Understand…” line, and nowhere else) is a bit of an ugly kludge, and the error checking around that whole concept isn’t great, so I’d avoid them except for the one single intended use-case: checking if “the topic understood” is listed in a given table.

For your specific use-case, then, I would suggest using the Conversation Framework extension, which defines a new action for asking someone about a thing as opposed to a topic. Then you can set a property on all the relevant things (“now the noun is asked-about”) and check that property to see if you’re allowed to take it. Much easier; much fewer headaches.

2 Likes