[I7] implicit taking happens before persuasion is decided

My latest trial and tribulation: I want a persuasion rule that makes a character refuse to do something, but the implicit taking rule is carried out so the character cheerfully starts doing the action before getting around to refusing to do it.

[code]“Easily persuaded?” by Zeborah

The Stage is a room. “You’re about to wow the audience with your magic trick. All you need to do is ask [Sally], your beautiful assistant, to take off your handcuffs.”

Sally is a woman in the Stage. The handcuffs are worn by the player.

A person can be polite.
After reading a command:
if the player’s command includes “please”:
now the player is polite;
cut the matched text;
otherwise:
now the player is not polite.

Persuasion rule:
if the player is polite:
persuasion succeeds;
otherwise:
say “‘You [italic type]might[roman type] say [’]please[’] when you ask,’ [the person asked] says petulantly.”;
persuasion fails.

A procedural rule when someone trying taking:
ignore the can’t take people’s possessions rule.

Instead of someone trying taking off:
say “Humming cheerfully, [the person asked] takes off your [noun].”;
rule succeeds.

Test me with “sally, take off my handcuffs / sally, please take off my handcuffs”.[/code]
results in:

This just seems wrong to me. But in the meantime, how can I tinker with the implicit taking rule for a non-player character? (Ideally I’d like to have it not print anything at all.) All my attempts at phrasing it get rejected by the compiler.

It’s late, so forgive me if I don’t explain this clearly or thoroughly enough, but…

This part is easy:Rule for implicitly taking the handcuffs: if the person asked is sally, silently try sally taking the handcuffs; otherwise continue the activity.… or more generally:Rule for implicitly taking the handcuffs: if the person asked is not the player, silently try the person asked taking the handcuffs; otherwise continue the activity.This will eliminate the message for either Sally or any NPC respectively, but retain the default for the player.

If your more general question is why an implicit take is going on at all, then that’s because of the way the taking off action is defined. (It requires the noun to be one carried thing). Although in my opinion this is not a desireable default behavior, it actually helps you in this particular case. The reason is that the taking off action is by default designed to allow actors to remove something that they are wearing. Under normal circumstances, Sally would fail the check rule for this and the action would fail as well. Since you’ve added an instead rule, you’ve preempted this check, but also the carry out as well. (Your addition of “rule succeeds” merely tells inform to treat it like a success – it doesn’t cause the action to succeed in the game world.) However, since the implicit take has already occurred, Sally ends up with the cuffs anyway and everything works out. Does that make sense?

The wording is a bit complex but this should work:

A procedural rule while asking someone to try taking off: ignore the carrying requirements rule.

Edit: Whoops, Mike beat me by two minutes. His solution looks better, anyhow.

Actually, now that I read this:

… I guess I missed the point of your whole post. You don’t really want to suppress the implicit take message, but rather the take itself. (That way you can go about the business of using persuasion rules to decide everything else.) In this case, I would go with Nitku’s suggestion, except it doesn’t appear to work for some reason. I actually tried that first and when it didn’t work, I figured “Screw it, Sally’s got the cuffs, so what difference does it make how it worked.” In this case, since you want to control (or eliminate) the implicit take completely, it does matter. Generally speaking, the carrying requirements rule (which is what causes the implicit take to fire) can be circumvented either by a procedural rule or a before rule. I’ve tried both with this code and it won’t work for some reason. With rules tracing on, I get “Rule “A procedural rule while asking someone to try taking off” applies.” – which is correct – and then the implicit take fires anyway, effectively ignoring the rule it just said it was following. This might be a bug having to do with the interaction of persuasion / carrying requirements / other actors, but there’s no way I can track it down tonight. Maybe the elves will come and work on it.

Thanks for the implicitly taking syntax - I kept trying to do something like “Instead of someone trying implicitly taking” as if it was any other action.

For the rest of it:

Ye-es: that is, I want to re-order it so that a failed persuasion suppresses an implicit take. Currently we seem to have things happening in this order:

  • player asks NPC to do something
  • implicitly taking is begun, printing “NPC first taking X”
  • persuasion rule is carried out - if it fails, we belatedly stop; otherwise
  • the taking action is carried out
  • the final action is carried out

Whereas I’d expect a sequence like:

  • player asks NPC to do something
  • persuasion rule is carried out - if it fails, we stop right there; otherwise
  • implicitly taking prints “NPC first taking X”
  • the taking action is carried out
  • action is carried out

…I’m not sure how clear I’m being, sorry.

I think part of the trouble here is that the phrase you’ve decided you want to use, “Sally, take off my handcuffs,” seems clear enough to you or I but is a bit confusing to Inform. Consider the following examples, seen while I ran your testcode:

sally, get handcuffs
“You might say ‘please’ when you ask,” Sally says petulantly.

sally, remove handcuffs
(Sally first taking the handcuffs)
“You might say ‘please’ when you ask,” Sally says petulantly.

sally, remove handcuffs from me
“You might say ‘please’ when you ask,” Sally says petulantly.

sally, take off handcuffs
(Sally first taking the handcuffs)
“You might say ‘please’ when you ask,” Sally says petulantly.

sally, take handcuffs off me
“You might say ‘please’ when you ask,” Sally says petulantly.

sally, take off my handcuffs
(Sally first taking the handcuffs)
“You might say ‘please’ when you ask,” Sally says petulantly.

What’s happening here is that Inform thinks we are asking Sally to take off some handcuffs worn by Sally; apparently it is trying to “help out” (gotta love those implicit actions) by having Sally first try to take the handcuffs, so that she can presumably then take them off (of herself). It seems sensible to the human reader that “take off my handcuffs” means we are instructing Sally to arrange things so that we are no longer wearing the handcuffs, but it’s not working out that way except in a very incidental sense (if Sally were wearing the handcuffs so that she could try to take them off, then it’s true the player would no longer be wearing them–but that misses the point of the whole exercise). Add in a little extra ambiguity from the difference between the taking action and the removing it from action, and I think that’s mostly what is at the heart of the trouble you’re having with this phrase.

I’m sorry I can’t be more helpful right at the moment, but I’ll play around with your code later to see if I can come up with anything. One quick thing I saw while pasting your code into Inform and typing a few variations of take/remove from into the test game is that if you haven’t already done so, you’ll probably want to add a small rule like:

Every turn:
now the player is not polite.

or else saying “please” to Sally one time will make her forever enthralled with the player.

Argh. I’m definitely not explaining this right. Let’s try a different verb so that my contortions of “take off” don’t get in the way:[code]“Easily persuaded?” by Zeborah

The Stage is a room. “You’re about to wow the audience with your magic trick. All you need to do is ask [Sally], your beautiful assistant, to eat the chocolate cake.”

Sally is a woman in the Stage. The chocolate cake is in the Stage. The cholate cake is edible.

A person can be polite.
After reading a command:
if the player’s command includes “please”:
now the player is polite;
cut the matched text;
otherwise:
now the player is not polite.

Persuasion rule:
if the player is polite:
persuasion succeeds;
otherwise:
say “‘You [italic type]might[roman type] say [’]please[’] when you ask,’ [the person asked] says petulantly.”;
persuasion fails.

Instead of someone trying eating:
say “Humming cheerfully, [the person asked] eats [the noun].”;
remove the noun from play;
rule succeeds.

Test me with “sally, eat the chocolate cake / sally, please eat the chocolate cake”.[/code]
Now when we test this we get:

At [1], the implicit take is ordered so that it says Sally takes the chocolate cake even though the persuasion rule says she refuses to act. (The persuasion rule does stop the actual taking, but comes too late to stop the ‘first taking’ line.) I’m saying it’d make more sense for the persuasion rule to be considered before anything else, including the implicit take.

(Re the ongoing politeness thing, that’s covered in the ‘otherwise’ part of the ‘after reading a command’ rule.)

[size=85]Oops, I thought I was being clever but in fact I was just being careless and not reading your code closely.[/size] :blush:

As soon as Inform begins trying to determine whether or not Sally can eat the cake, the implicit taking action will occur automatically (and annoyingly in my opinion); this means you have to intercept the whole action prior to it reaching that stage. I guess that’s the point I was trying to make in my other post–that you generally had the right idea but were trying to intercept the wrong action (taking, as opposed to removing it from).

In the eating example, if I understood correctly (if not it’s certainly my fault rather than yours) I think this is what you’re looking for:

[code]The Stage is a room. “You’re about to wow the audience with your magic trick. All you need to do is ask [Sally], your beautiful assistant, to eat the chocolate cake.”

Sally is a woman in the Stage. The chocolate cake is in the Stage. The chocolate cake is edible.

A person can be polite.

After reading a command:
if the player’s command includes “please”:
now the player is polite;
cut the matched text;
otherwise:
now the player is not polite.

Persuasion rule:
if the player is polite:
persuasion succeeds;
otherwise:
say “‘You [italic type]might[roman type] say [’]please[’] when you ask,’ [the person asked] says petulantly.”;
persuasion fails.

Before asking someone to try eating something:
if the player is polite:
unless the person asked encloses the noun:
try the person asked taking the noun;
otherwise:
say “You [italic type]might[roman type] say [’]please[’] when you ask,’ [the person asked] says petulantly.” instead.

After Sally eating the chocolate cake:
say “Humming cheerfully, [the person asked] eats [the noun].”.[/code]
By intercepting the Sally’s eating action before we officially ask her to try eating, we are able to cut off the automatic implicit-taking-while-checking-eatability activity that occurs (even prior to any “Before” rules we might directly write regarding it) when Sally starts to consider eating the cake on her own. Note that we’re considering the results of the persuasion rule here, and we didn’t actually intercept the persuasion rule itself; nor is it necessary to do so unless the code grows considerably more complex.

Therefore we have:

sally, eat cake
You might say ‘please’ when you ask," Sally says petulantly.

sally, please eat cake
Sally picks up the chocolate cake.

Humming cheerfully, Sally eats the chocolate cake.

If you prefer the original reporting style of the implicit action in cases where Sally does eat the cake, you could of course change the Before rule to:

Before asking someone to try eating something: if the player is polite: unless the person asked encloses the noun: silently try the person asked taking the noun; say "(first taking [the noun])" otherwise: say "You [italic type]might[roman type] say [']please['] when you ask,' [the person asked] says petulantly." instead.
Hopefully the above is more helpful to you than my first post; if not please say so and we’ll try again.

Perhaps I’ve misunderstood you, but it seems to me that Nitku’s procedural rule (or a more general version of it) does what you want:

[code]The Stage is a room. “You’re about to wow the audience with your magic trick. All you need to do is ask [Sally], your beautiful assistant, to eat the chocolate cake.”

Sally is a woman in the Stage. The chocolate cake is in the Stage. The chocolate cake is edible.

After someone eating:
say “Humming cheerfully, [the person asked] eats [the noun].”;

A person can be polite.
After reading a command:
if the player’s command includes “please”:
now the player is polite;
cut the matched text;
otherwise:
now the player is not polite.

Persuasion rule:
if the player is polite:
persuasion succeeds;
otherwise:
say “‘You [italic type]might[roman type] say [’]please[’] when you ask,’ [the person asked] says petulantly.”;
persuasion fails.

A procedural rule while asking someone to try doing something:
ignore the carrying requirements rule.

Test me with “sally, eat the chocolate cake / sally, please eat the chocolate cake”.[/code]
Sally still picks up the cake before eating it, because the procedural rule just stops the implicit take when we are requesting the action; as soon as the persuasion succeeds a new action is started (“Sally eating the cake”), which goes unaffected.

Well, it’s a bit complicated I think, because generally you want the instead rules between the carrying requirements and the persuasion checking rules: instead rules for actions that require carried things should be able to assume that we are definitely carrying the thing, and you may want to be able to write rules like Instead of asking the robber to try attacking the player, say “You don’t want to encourage him!”

I don’t see why the carrying requirements rule is applied at all when requesting actions though. Surely there’s no need for Sally to carry anything for us to ask her to do something? Or am I overlooking something?

Thanks all. Among the various suggestions here, I seem to have got my own code sorted out now, so just carrying on out of academic interest:

Endosphere - yeah, choosing the right point at which to intercept actions is the tricky part. :confused:

SJ_43 -

Asking itself has no carrying requirements, though - that only attaches to the thing you’re asking the npc to do. So something like:

[code]Instead of asking the robber to try eating the chocolate cake for the first time, say “Are you sure you want to encourage him?”

Persuasion rule for the robber trying eating the chocolate cake:
say “‘Chocolate’s bad for my digestion,’ the robber says grumpily.”;
persuasion fails.[/code]

should imho work so that the “instead” rule can intercept the asking; but if the player insists then the persuasion rule can intercept the robber agreeing to do it; but if the robber did agree, then the implicit-taking-before-eating could come into play. (As opposed to now, where it comes into play after the instead-of-asking rule but before the persuasion rule.)

Anyway it’s kind of a moot point - how it works is how it works so I’m just grumping really. :slight_smile:

No, the carrying requirements rule is applied to Sally-trying-eating. Even if she hasn’t yet been successfully persuaded to eat it. (grump grump :slight_smile: )

Actually I was kind of overlooking something:

[1] sally, eat the chocolate cake
(Sally first taking the chocolate cake)
“You might say ‘please’ when you ask,” Sally says petulantly.

The parenthesis here isn’t saying that Sally tries to take the cake: it says that we first ask her to take it, and it is this request that she responds to.

Well, that’s one great thing about Inform: it’s so easy to rearrange rules to suit your personal preferences.