I7: The Trouble with Npcs (Part 1)

The trouble with npcs (part 1) is that:

 	a) there doesn't seem to be a way to write persuasion rules to account for relations amongst actors unless one of the actors is the player, and

 	b) even if such persuasion rules could be written, there doesn't seem to be a way to construct action rules that effect an npc asking another actor to try doing something.

If there is any way to do either of these things I certainly can’t figure it out, despite hours of trying.

For the purposes of discussion, let’s consider the following scenario:

[code]The Patio is a room. The description of the patio is “Your family has gathered on your backyard patio to have a barbecue on this fine sunny day.”.

A grill is a container in the patio. The grill is closed and openable. The description of the grill is “Your propane grill is fired up and ready to go.”.

A table is a supporter in the patio. The description of the table is “A flimsy aluminum card-table.”.

A platter is on the table. The description of the platter is “A large ceramic plate”.

A steak is a kind of thing. The description of a steak is usually “A juicy, well-marbled raw steak.”.

Five steaks are on the platter.

Marriage relates one person to another (called the spouse).

The verb to be married to implies the marriage relation.

Dominance relates various people to various people. The verb to dominate (he dominates, they dominate, he dominated, it is dominated, he is dominating) implies the dominance relation.

Joe is a man in the patio. The player is Joe. The description of Joe is “It’s you! You’ve had a few too many beers, and are having trouble concentrating on what needs to be done.”.

Helen is a woman in the patio. The description of helen is “It’s Helen, your lovely wife. Luckily she’s here to keep the household running smoothly.”.

Timmy is a man in the patio. The description of Timmy is “It’s your eight-year-old son, Timmy.”.

Sara is a woman in the patio. The description of Sara is “It’s your twelve-year-old daughter, Sara.”.

Eddie is a man in the patio. The description of Eddie is “It’s your sleazy brother-in-law, Eddie. He was here in a flash when Helen told him there would be free food.”.

When play begins:
now Joe is married to Helen;
now Joe dominates Timmy;
now Joe dominates Sara;
now Helen dominates Timmy;
now Helen dominates Sara;
say “Objectives: 1) have Helen successfully instruct a Sara to get the platter, resulting in compliance; 2) have Helen instruct Eddie to take a steak, which Eddie will refuse to do; 3) have Helen successfully instruct Joe to take a steak, resulting in compliance.”;
say paragraph break.[/code]
I’ve tried all sorts (literally dozens) of various ways of constructing and phrasing different rules to enact something that would be conceptually similar to the following:

[code]1) A persuasion rule:
if the “person asking” is the spouse of the person asked:
persuasion succeeds;
otherwise if the “person asking” dominates the person asked:
persuasion succeeds;
otherwise:
persuasion fails.

  1. Before/check/instead of/carry out/after/report an actor asking another actor to try doing anything:…

  2. Every turn/after X condition holds:
    try actor #1 asking actor #2 to try doing something…[/code]
    I can’t find a way to do any of these, and am starting to think it’s just not possible. I originally hit upon this problem while constructing a scenario with some soldiers, where everyone (including the player) would be obliged to follow orders from a superior officer, but that seems implausible unless I can work out the much simpler scenario posted here. Whether or not the general concept of npcs controlling other actors is undesirable is in my opinion a wholly separate matter from whether or not the idea is technically feasible–and if it can be done I’d like to know how.

Does anyone have any suggestions?

Inform’s action model isn’t sophisticated enough to handle this. An action can be requested (“asking … to try …”), but the system doesn’t keep track of who is requesting the action – the requester is always presumed to be the player.

You might be able to work around that by using a global variable to store the identity of the person making the request, which you could check from persuasion rules and so on. But you won’t be able to describe actions that way (“try actor #1 asking actor #2 to try doing something”), at least without some I6 trickery, because I7 isn’t set up for it.

Thanks for the response, vaporware.

Of the many things I tried, I thought the following approach held particular promise:

[code]The current-asker is a person that varies.

Before [an actor/a person/someone] asking [anyone/a person] to try doing anything:
change the current-asker to the actor;
continue the action.

A persuasion rule:
if the current-asker is the spouse of the person asked:
etc. [/code]
But the problem was, as you noted, that I couldn’t find a way to construct the “Before” rule; the only way to construct a rule that would even compile was by writing just:

Before an actor asking:

which of course refers to the action of an actor asking about something–not at all what was intended. Although not relevant to the current discussion, an interesting side note to this particular approach was that when I put a check in the persuasion rule that said:

say “[current-asker], [person asked]”;

Inform listed the current-asker as that ancient nemesis, “your former self.” :angry:

I tried making an example based on vaporware’s suggestion, perhaps it will give you some ideas… The syntax is “try the thief requesting the action of the troll dropping the axe” (I know, it’s a bit lengthy :wink:). The command persuasion rules work like the persuasion rules, but I put them before even the before rules so an action won’t start unless the persuasion succeeds. In this scenario a gang of soldiers give each other orders, and they (including the player) have to obey those with a higher rank.

[code]The current requester is an object that varies.

To try (requester - a person) requesting (deed - a stored action):
change the current requester to the requester;
try the deed;
change the current requester to nothing;

The command persuasion rule is listed before the before stage rule in the action-processing rules.
This is the command persuasion rule:
if the current requester is a person:
follow the command persuasion rules;
unless the rule succeeded, stop the action.

The command persuasion rules is a rulebook. Command persuasion rules have outcomes persuasion fails (failure) and persuasion succeeds (success).

Rank is a kind of value. The ranks are Private, Sergeant and Colonel.
A person has a rank. Before printing the name of a person: say "[rank] ".

The Minefield is a room. Jones, Lewis, Roberts, Lee and Jackson are people in the minefield.
The rank of Jones is colonel. The rank of Roberts and Lee is sergeant.
Rule for printing the name of the player: say “Player”.

Instead of someone jumping:
if the player can see the actor, say “[The actor] skips about for a while.”;

Instead of doing something when the current requester is a person:
say “Well, you don’t really have a choice… [run paragraph on]”;
continue the action;

Command persuasion rule for an actor doing something:
if the rank of the current requester is greater than the rank of the actor, persuasion succeeds;
if the actor is not the player and the player can see the actor, say “‘No way,’ [the actor] growls.”;
persuasion fails.

Every turn:
let requester be a random person that is not the player;
let subject be a random person that is not the requester;
say “’[Subject], let me see you jump!’ shouts [the requester].”;
try the requester requesting the action of the subject jumping;

Test me with “z/z/z/z”.[/code]

I wasn’t actually sure exactly what you wanted to do, so I also tried this thing where you can tell NPCs to give orders to each other (like “patient, tell doctor to examine you”).

[code]The instructor is a person that varies.
The instructee is a person that varies.
The instructed command is indexed text that varies.
The instruction stage is a number that varies.
[“instructing” is only true when an NPC (the instructee) is acting by order of another NPC (the instructor)]
To decide whether instructing: if the instruction stage is positive, yes; no.

Before reading a command when instructing: decrease the instruction stage by one.
For reading a command when instructing:
change the text of the player’s command to “[instructee], [instructed command]”;
[so that “tell doctor to jump” works just like “doctor, jump”: ]
if the instructor is the player, change the instruction stage to 0;

Ordering it to is an action applying to one thing and one topic.
Understand “tell [someone] to [text]”, “ask [someone] to [text]” or “order [someone] to [text]” as ordering it to.
Understand the command “instruct” as “order”.

Carry out an actor ordering someone to:
change the instruction stage to two;
change the instructor to the person asked;
change the instructee to the noun;
change the instructed command to the topic understood;

[To keep the every turn rules, advance time rule, etc. from running twice: ]
The skip to next turn before instructing rule is listed before the every turn stage rule in the turn sequence rulebook.
This is the skip to next turn before instructing rule: if the instruction stage is greater than one, rule succeeds.

[To avoid “There is no reply” if we type “doctor, tell patient to adsfasd”: ]
Instead of answering someone that when instructing, say “[The instructor] gives you a confused look.”

Understand “herself/himself” as a person when instructing and the item described is the instructee.
Understand “you” as a person when instructing and the item described is the instructor.

A first persuasion rule for asking someone to try ordering someone to: persuasion succeeds.

Persuasion rule when instructing (this is the NPC persuades NPC rule):
if the instructor is a woman and the instructee is a man, persuasion succeeds;
if the instructor is the instructee, say “That’s too complicated.” instead;
say “[The instructee] ignores [the instructor].” instead;

[Persuasion rules that are only for when the player asks an NPC need “when not instructing” appended to them: ]
Persuasion rule for asking someone to try doing something when not instructing: say “[The actor] sniffs. ‘The only thing I’ll do for you is tell other people what to do.’” instead.

The Lab is a room. The doctor is a woman in the lab. The patient is a man in the lab.

Test me with “tell doctor to examine patient / patient, tell doctor to examine you / doctor, tell patient to exmaine himself/ doctor, tell patient to examine himself”.[/code]

Thanks for the response, SJ_43. Those two examples are awesome, and I sincerely appreciate you taking the time to write them (and “pulling out the heavy artillery” so to speak while so doing). Actually both examples demonstrate things I’ve unsuccessfully tried to do in the past, and are very helpful. I don’t believe I would ever have come up with the first line of the first example, “The current requester is an object that varies,” on my own. Initially I was having trouble understanding why you chose to define this as an object and even changed the phrase to “The current requester is a person that varies” while playing with the example (which subtly breaks the resulting game), until I realized how this definition interacts with the “nothing” status assigned to the variable.

Thanks again.