Adding properties to Simple Chat nodes

I have a roughly linear conversation I’m trying to create using Simple Chat. Since most of the choices at each stage of the conversation are the same, I thought it would be helpful to say something like:

Instead of finding responses to a level-3 chat node:

I discovered I can do this:

A chat node can be level-0, level-1, or level-2.

But this seems like it would quickly get out of hand. I’d rather do this:

A chat node has a number called level.

Unfortunately, neither of these work:

Instead of finding responses to a chat node with level 3: Instead of finding responses to a level 3 chat node:

And although this syntax works, I find it unreadable:

Instead of finding responses to a 3 chat node:

Any suggestions?

Some source for you to play with:

[spoiler][code]Conversation is a room.

Include Simple Chat by Mark Tilford.
Use default forbid exiting conversations.

a chat node can be innocuous, questionable, rude, or innocence-asserting. a chat node is usually innocuous.

a chat node can be level-1, level-3, or level-5.

hello is an innocuous level-1 chat node.

goodbye is a rude level-3 chat node.

why, wherefore, and how are questionable level-5 chat nodes.

Instead of giving text for hello, say “hello.”

Instead of finding responses to hello:
link to goodbye;

Instead of giving link to goodbye, say “goodbye.”

Instead of giving text for goodbye, say “well, I never!”

Instead of finding responses to a level-3 chat node:
link to why;
link to wherefore;
link to how;

Instead of giving link to how, say “How?”

Instead of giving text for how:
say “however.”;
end the game saying “end”;

Instead of giving link to why, say “Why?”

Instead of giving text for why:
say “whyever.”;
end the game saying “end”.

Instead of giving link to wherefore, say “Wherefore?”

Instead of giving text for wherefore:
say “whereforever”;
end the game saying “end”;

When play begins:
run a conversation from hello.
[/code][/spoiler]

Method 1:
Create a table with three columns, one with a chat node, one a chat level, one politeness level.
Have a “carry out finding responses to” rule that looks for the appropriate line in the table.
Have that routine choose the responses based on those values.

Method 2:

chat level is a number that varies.
chat politeness is a politeness that varies.

To say set level (new level - a number): now chat level is new level.
To set politeness (new level - a politeness): now chat politeness is new level.

Before giving text for: now chat politeness is innocuous.

Carry out finding responses to when chat level is 3: link to why; link to wherefore; link to how.

Report giving text for ...:
    instead say "[set level 3][set politeness rude]...".

If all you want is more readable code, you could try adding a definition that acts as a shortcut of sorts (not tested):

To decide whether (target - a chat node) is level (x - a number) chat node: if the level of target is x, decide yes; decide no.

That would be great, but I’m back to this message:

How about "Instead of finding responses to when the chat node understood is a level 3 chat node:

That works… if the “To decide” phrase is edited slightly:

Thanks for leading me to the right syntax. You don’t need the “to decide” phrase if you do it this way:

Instead of finding responses to when the level of the chat node understood is 1:

But as far as readability goes, I think the original enumerated type solution was best. I think I’ll stick with that.

I was just looking at the source code for Simple Chat, and realized you can create new instances of a kind of value! I did not know that, but in fact a chat node is a kind of value, and that’s just how Simple Chat works!

I’m very happy with this:

conversation-level is a kind of value. The conversation-levels are level-0.
a chat node has a conversation-level. The conversation-level of a chat node is usually level-0.

level-1 is a conversation-level.
raise-hand, bathroom are level-1 chat nodes.
key-please is a chat node.