Matching a type of behavior with varying numbers of nouns

I have several custom actions for conversation, and am trying to define using those actions on a person to be “conversatory behavior.” This works fine for the action with only one noun: greeting is conversatory behavior triggers the before doing something to the guard when conversatory behavior rule when the action is greeting the guard. However, discussing is conversatory behavior (and variations like “discussing something with”) does not trigger that rule when the action is discussing yourself with the guard, only when the action is discussing the guard with yourself. Is there a way to get the action and/or rule to match only the first of those (while still working correctly for the greeting action)?

I figured out a solution: changing the rule to before doing something when conversatory behavior and the noun is the guard or the second noun is the guard matches all scenarios, and I can then restrict it with if the current action is not greeting and the second noun is not the guard: do nothing;

Figures I’d only get it working after finally deciding to ask for help. : )

Welcome to the forum.

This feature is kind of underdocumented.

When you set up a “kind of action”, the logic produced is a routine that looks at the parts of the action (see WWI 12.20 Stored Actions) to see whether the current action matches any of the various statements about what fits that category of action.

You mention the declaration Discussing is conversatory behavior. Is there a discussing action separate from the discussing it with action? If so, that would count as a different action than discussing it with, and it’s that action that will count as conversatory behavior. If there is not a separate discussing action, then discussing it with would be conservatory behavior no matter what the noun and second noun are.

For actions requiring both a noun and second noun, you can constrain for one or the other using these patterns:

Putting something on the table is categorized behavior. [second noun specified but not noun]
Inserting the envelope into is categorized behavior.	[noun specified but not second noun]
Giving is categorized behavior.							[neither noun nor second noun specified]

For actions that share the same verb word, you should be able to distinguish between them:

Discussing is conversatory behavior.		[action taking one object]
Discussing with is conversatory behavior.	[action taking two objects, omitting "it"]
1 Like

There are two other things I would like to note.

  1. It’s not necessary for the name to end in “behavior”. There’s no issue with it, but if you did it because you thought you had to and weren’t really happy with it, then I thought it might be nice to know that you don’t have to.
  2. Normally you’d use the action as Before conversatory behavior rather than Before doing something when conversatory behavior. Both end up doing the same thing, and the latter is a bit more flexible (since you can also do something more complex like Before doing something except greeting when conversatory behaviour), but the other way is shorter (if you care about such things) and is also “less specific” for the laws of rule sorting.

There is not. I had been attempting to figure out how to hint to the parser that I meant for the “to the guard” to apply to the second noun for that particular action. In hindsight I probably should have started by trying to modify the before rule.

I suspected that was probably the case, but I didn’t try to test it, since I’d probably just call them all “behavior” anyway. All of my scene names end in “scene” because otherwise I can’t remember what they are. : )

1 Like

That is a totally valid approach to naming. The only place where Inform actually enforces it is rules, though.

Also sort of actions: every action needs a verb ending in -ing somewhere in it. Some people just take the command and shove -ing on the end (“xyzzying”) and some people try to phrase it in a reasonable English way (“saying xyzzy”). I’m in the latter camp.

1 Like

It actually will compile (at least in Inform 10) if you don’t put -ing on the end, but it’ll produce an action with no past participle. I personally wouldn’t recommend doing this, ever; but if you do want to do it for some reason, you should probably add a with past participle something clause to the action definition.

I don’t know if an action that doesn’t end in -ing will have problems being recognized in other contexts, like action patterns… but I would suspect it to be fine in most cases, even if you have to prefix it with trying.

1 Like