Accessing an NPC's actions (and kinds of action)

Is there any way to access the action that an NPC is currently trying? It seems to me as though there must be, somewhere, for actions tracing to be able to print things like “[(2) - Jordan attacking Taylor]”, but I’m not sure how to find it. (Is it I6?)

Also, is there a way to apply kinds of action to NPC actions? Example 184 shows that “Instead of asking someone to try misbehavior” works, but is there any way to make this work when the NPC is actually doing misbehavior?

Here’s an example of the sort of thing where this might apply – ideally Mr. Stephens would speak up when Jordan and Taylor misbehave as well. To do that I’d need to be able to check when they engaged in an action that was prohibited behavior, and then access the parts of that action in order to construct the thing he says. Right now both those things work only for the PC.

[code]The Classroom is a room. A man called Mr Stephens is in the classroom. The description of Mr Stephens is “He doesn’t look too committed to this whole substitute teaching thing.” The printed name of Mr Stephens is “Mr. Stephens”. Jordan is a woman in the classroom. Alexis is a woman in the classroom. The player is Alexis. Taylor is a woman in the classroom.

Singing is prohibited behavior. Attacking someone is prohibited behavior.

Every turn when the current action is prohibited behavior:
say “Mr. Stephens says, ‘[if the person asked is the player]Alexis[otherwise][Person asked][end if], stop [action name part of the current action][if the noun part of the current action is not nothing] [noun part of the current action][end if].’”;
continue the action.

The block attacking rule is not listed in any rulebook.
The block singing rule is not listed in any rulebook.

Instead of an actor singing:
say “[If the person asked is the player]You sing[otherwise][The person asked] sings[end if] a bit.”;
continue the action.

Carry out an actor singing:
try Jordan attacking the person asked.

Report an actor attacking:
say “[If the person asked is the player]You beat[otherwise][The person asked] beats[end if] furiously at [if the noun is the player]you[otherwise][the noun][end if].”

Instead of waiting:
try Taylor singing.

Test me with “sing/z/hit jordan”.[/code]

The fact that the “current action” variable is visible outside actions at all is mostly a historical coincidence. The proper way (IMO) to make NPCs react to actions is to make the rule part of the action processing, e.g. like this:

After an actor [doing some] prohibited behavior in the presence of Mr Stephens:
	let the target be the noun part of the current action;
	say "Mr. Stephens says, '[Printed name of the person asked], stop [action name part of the current action][if the target is not nothing] [printed name of the target][end if].'";
	continue the action.

However, note that “after” rules fire before “report” rules (and “report” rules must be action-specific), so just plugging the rule above into your example will produce a rather odd sequence of messages:

> sing
You sing a bit.
Mr. Stephens says, "Jordan, stop attacking Alexis."
Jordan beats furiously at you.
Mr. Stephens says, "Alexis, stop singing."

A simple workaround, in this case at least, would be to turn the “report an actor attacking” rule into a “carry out” rule (and optionally the “carry out an actor singing” rule into an “after” rule), which would rearrange the output into:

>sing
You sing a bit.
Mr. Stephens says, "Alexis, stop singing."
Jordan beats furiously at you.
Mr. Stephens says, "Jordan, stop attacking Alexis."

Thank you, that’s extremely helpful! The things I were missing were (no. 1) that “an actor prohibited behavior” would work, and (no. 2) that “the current action” will be whatever action is being tried if it’s invoked in an action-processing rule.

(Actually if I hadn’t been getting fancy with my example I might have stumbled on no. 2 myself; the only reason I was using an “every turn” rule was to make the text come out in the right order, but since I couldn’t trap prohibited behavior by the NPCs I never got the chance to test “the current action” within an After rule, where I would’ve seen that it worked. Moral: Test one thing at a time!)

As far as making the text come out nicely, my instinct would be to write a rulebook that runs after the Report rules for any given action, thus:

[code]The After-Report rules are an action based rulebook.
A specific action-processing rule (this is the run the after-report rules rule): consider the After-Report rules.
The run the after-report rules rule is listed after the report stage rule in the specific action-processing rulebook.

After-Report an actor prohibited behavior in the presence of Mr Stephens:
say “Mr. Stephens says, ‘[if the person asked is the player]Alexis[otherwise][Person asked][end if], stop [action name part of the current action][if the noun part of the current action is the player] Alexis[otherwise if the noun part of the current action is not nothing] [noun part of the current action][end if].’”;
continue the action.[/code]

Somewhat to my surprise, this seems to have worked the way I typed it in.