A persuasion conundrum

For a particular NPC only, I’m trying to interpret all “woman, [try something]” commands as talking to (an action which I have already defined and is working great). Nothing I try for this works, including:

Persuasion rule for asking the well-dressed woman to do something: try talking to the well-dressed woman instead.

Any help is appreciated! Thanks

Persuasion rules aren’t like regular Inform rules - they just end in “persuasion succeeds/persuasion fails”, at which point the usual action processing machinery takes over (they can also print a custom failure message, but I believe that’s it). So all you need to do is have the body of the persuasion rule be “rule succeeds”, then write a rule like;

Instead of asking the woman to try doing something: try talking to the woman.

(It occurs to me that instead rules might fire before the persuasion check, in which case you’d just need the latter rule, but I’m not in front of my computer to check. But either way hopefully the info on persuasion rules is helpful!)

4 Likes

They do, yes.

2 Likes

Welcome to the forum, Ryan.

asking someone to is a weird pseudo-action, and the docs don’t explain it well.

If you say alice, go north, then, after the parser does its thing, the state of the current action is:

  • act_requester (an I6 variable that isn’t shared with I7 by default): the player
  • actor: alice
  • action name: going
  • noun: north

That the actor is not the player and act_requester isn’t nothing is how Inform knows the persuasion rules should be followed. Unless the persuasion rules end in success, the action is stopped.

If the persuasion rules do end in success, the existing value of act_requester is saved, and act_requester is set to nothing: this makes the action indistinguishable from what it’d be if your code had said try alice going north. Then we try that action. If that action fails, we follow the unsuccessful attempt by rules. Then, act_requester is restored.

Since this was an asking someone to action and persuasion had succeeded, asking someone to succeeds whether or not alice’s action failed. So we continue to the after rulebook for asking someone to. (asking someone to is the anti-out-of-world action: it can only have before, instead, after rules; it can’t have check, carry out, report.)

Anyway, if I understand your intent, this would be what you want:

Lab is a room.

alice is a woman in the lab. 

after talking to someone: say "you sure told them."

talking to is an action applying to one thing.

before asking someone to try doing anything:
  instead try the player talking to the actor. [ this looks weird, but it's appropriate ]

test me with "alice, n".
6 Likes
instead try talking to the person asked.

looks less weird & is exactly equivalent:

(i) [the player] is implied in any action pattern where the person performing it isn’t specified.
(ii) ‘the person asked’ is an I7 alias for the I6 variable actor and can be used anywhere in the source code since the I6 variable is global.
The I7 ‘object which varies’ ‘actor’ is set to be equal to the I6 actor at the start of action-processing, and can’t be used in source code outside the context of action-processing. But within action processing, I7 ‘the person asked’,and I7 ‘actor’ are equivalent (unless author code inteferes to set ‘actor’ to something else).

2 Likes

yes, that code conveys its meaning much better!

1 Like

[EDIT: Fixed! In addition to the suggested code, I added:

After reading a command:
	let T be "[the player's command]";
	If word number 1 in T is "woman":
		replace the player's command with "talk to woman".

]
Thank you everyone for the excellent replies!

@DeusIrae , that partially did the trick:
Instead of asking the well-dressed woman to try doing something: try talking to the well-dressed woman.
It works for commands like “woman, get pigeon” but not “woman, hello”. My goal is to change any “woman, *” command into talking to the woman, if possible.

@Zed and drpeterbatesuk , this also works but with the same result (doesn’t apply to “woman, hello”).

I’m getting closer, I can feel it…

“woman, hello” is a different action – the “answering it that” action. You need a rule to intercept that as well. In this case the default action is handled with a report rule so you could simply write a check rule:

Check an actor answering something that (this is the redirect answering rule):
	try talking to the noun instead.

Note that with this action, the person to whom the question is being asked is the noun. Check the actions index for a more thorough explanation. Also, you can find out what actions are being triggered when you type a command by typing “actions” at the game prompt when running it in the IDE.

5 Likes