[I7] Repeating through lists and indexed text

Hey there!

I am working on setting up some conversation trees for my NPCs. Here is what I have:

Instead of speech when the noun is the receptionist: repeat through Table of the receptionist's commentary: if the topic understood includes topic entry: say "[commentary entry][paragraph break]"; rule succeeds;

Table of the receptionist's Commentary topic commentary "hi/hello" "She gives you a long, telling look over the rim of her glasses, then goes back to typing." "door" "'When your number comes up, you get to go through. Or expire. Same amount of paperwork for me.'"

Whenever the player says “say X” it runs through the table to see if X matches a topic, and says the associated response. Now, I want to add a metagame tag that lets the player have an explicit view of the available topics, so they don’t get stuck. Here is what I am starting with:

MTL is a list of indexed text that varies. to say metatopics for receptionist: truncate MTL to 0 entries; repeat through table of the receptionist's commentary: add the "[topic entry]" to MTL; say "(Available topics are [MTL])";

What I would like this to do is run through the table of commentary, add all the topic entries to a list of indexed text, then print it out. However, it fails on the topic entry section.

On a related note, is there any way to add code to tables? I eventually would like to have the number of conversation options to grow over time, and to do that I would like to add additional topic and response entries to the table. Right now, I can hack it by adding a “if topic is X” line to the speech replacement bit, but if there would be any way to do that inside of the table, that would be helpful. I am guessing I will probably have to do something like a response entry of “[receptionistentry1]” followed by “to say receptionistentry1:” to actually execute.

You’re right about your last point. I don’t think you can go about putting code in a table unless it’s a very roundabout kind of thing. Making a token through “to say” like you suggested is probably the quickest way to do it.

As for the problem with “topic understood”, I guess topics are not quite as printable as they appear? If you don’t mind adding more data to your tables, you can probably add a few columns. One column of texts which contain the conversation hints for the player, and maybe even an extra that can contain some control variables for each topic. That way you can control which ones are listed to the player. That’s how I might go about it, anyway.

Topics are not printable because a topic like “hi/hello” can contain way more options than the player cares about seeing. (Not in that case, perhaps. But the game author needs to be able to add synonyms freely, without worrying about how it will clog up the game output.)

You can add rules to a table, and rules are code. Not sure if that’s what you need to be doing here, but you can do it.

Aha. Looking through a few extensions from others I see that you are right. I kind of wish the documentation was more clear about rules in tables. I could have used that at some points.