Implicitly taking when the actor is not the player

Not being very fond of the (first taking the thingy) report that happens due to the rule for implicitly taking something, I wrote this:

A magical item is a kind of thing.

Rule for implicitly taking a magical item:
	say "[We] [don't] have [regarding the noun][them]." instead.

All good so far. Still, I need to make this work for NPCs as well, as in WITCH, GIVE ME THE AMULET. [We] is always the player, so it gives the response You don’t have it. I tried say "[The actor] [don't] have... but I get this error message:

Problem. In the sentence ‘say “[The actor] [don’t] have [regarding the noun][them].”’ , I was expecting to read an object, but instead found some text that I couldn’t understand - ‘actor’.

I’ve seen [the actor] substitution being used here and there in the documentation. I’ve noticed that it is always used with Check / Report rules. Can it not be used in a rule like rule for implicitly taking?

I also tried:

Rule for implicitly taking a magical item:
	if the actor is the player:
		say "[The actor] [don't] have...

and I still get an error message—probably for the same reasons.

So, how can I get a rule for implicitly taking... to work for NPCs?

The actor is not a global variable; it’s a variable of the action-processing rulebook. As you found, this causes problems if you try to access it outside an action rule. It’s not great.

Best I can suggest is to write an early “check taking” rule which sets a global variable somewhere. But this could cause problems if you have a line like “try Fred trying taking the keys”; that would leave the global with the wrong value afterwards.

The sanity-check rules are a rulebook.

This is the sanity-check stage rule:
    abide by the sanity-check rules.

The sanity-check stage rule is listed after the before stage rule in the action-processing rules.

Sanity-check giving a thing to:
    if the player is not carrying the noun, say "[We] don't have it.";
    stop the action.

Sanity-check asking people to try giving:
    if the person asked is not carrying the noun, say "[regarding the person asked][They] [regarding the person asked][don't] have it.";
    stop the action.

That’ll cover the give amulet to witch and witch, give me amulet cases. You could silently abort the implicit take altogether easily enough:

Rule for implicitly taking something:
    stop the action instead.

but as @zarf indicated, implicitly taking is an activity, not an action, and once you’re inside the implicitly taking rulebook you don’t have access to the info you would need to print the message.

I’m not sure how feasible it is to win the game of whack-a-mole you’d be playing with the actions that could end up invoking it.


You can often use “the person asked” in place of “the actor” in this kind of situation. It refers to the same underlying I6 variable. (I believe zarf once gave this same advice to me; there may be a good reason that he didn’t recommend it in this case.)

Note that in some cases the implicit “take” is in the form of a taking off action, e.g. dropping a worn item. If you want to prevent that, there is more work to do.

1 Like

Overriding the carrying requirements is probably a terrible idea with a zillion ways to bite one in the hindquarters, but this works to the superficial extent I’ve tried…

Action-processing (this is the don't have it rule):
    unless the action requires a touchable noun, make no decision;
    if the actor is not carrying the noun begin;
        if the action requires a carried noun or eating a portable thing or inserting something into or putting something on begin;
        say "[if the player is the actor][We][otherwise][regarding the actor][They]";
        say " [don't] have [regarding the noun][those].";
        stop the action;
    end if;
end if.

The don't have it rule is listed instead of the carrying requirements rule in the action-processing rules.

I haven’t tried it, but I have a hunch that, if the actor is the player, “the person asked” will produce “nothing.”

This should certainly work for this purpose- it translates to the I6 global variable “actor” which I believe should always be in sync with whoever is trying to perform the action currently under consideration.
For ‘normal actions’ such as that produced by ‘Take book’ the person asked is therefore simply the player.

Rule for implicitly taking something:
	say "[The person asked] [don't] have [regarding the noun][them]." instead.

substitutes correctly whether the actor is the player (‘You don’t have it’) or somebody else (‘Mr Darcy doesn’t have it’).


Nice. That’s certainly more straightforward!

This is really impressive! I wouldn’t have known! Thank you!

Wait. So, one can use [person asked] instead of [We], at all times? Sure, it’s longer, but it catches all cases, persuasion or not.

In most cases, when giving responses within action processing rulebooks such as Before, Instead, Check, Carry Out, After, Report it’s equivalent to [actor], but outside of action processing rulebooks, when [actor] is not available, it should work equivalently if more long-windedly.

If you want a shorter substitution, you can either create one within I7 with:

To say Doer: say "[Person asked]".
To say doer: say "[person asked]".
To say The doer: say "[The person asked]".
To say the doer: say "[the person asked]".
To say A doer: say "[A person asked]".
To say a doer: say "[a person asked]".

or via I6 with:

The doer is an object that varies.
The doer variable translates into I6 as "actor".

in which case [doer] becomes exactly equivalent to [person asked], substituting as ‘yourself’, ‘Mr Darcy’; ‘cat’ etc. while [The doer] substitutes as ‘You’ etc. and [the doer] as ‘you’ etc. etc.

As an aside, ‘the person reaching’, which is included in I7 for use in accessibility rules, also translates to the I6 variable ‘actor’ and is exactly equivalent to ‘the person asked’.