Completely stuck with a "before" rule ...

Sigh,

my struggle continues … :slight_smile:

I have one rule like:

Before  the player asking someone (called askee) about something

Now, this works fine (I got it from an example, though).

I need to intercept other actions as well. So one of them might be the opening action. I enabled action report and from after “ordering” a person to open the wardrobe the display was:

So I assumed (probably wrongly so) that “asking someone to try opening something” would be the ticket to intercept that with a before rule.

But :

Before the player asking someone to try opening something:

fails with:

And I did try oh so many permutations of that - I NEVER got it to compile.

Before the player asking someone to try opening something
Before the player asking someone trying opening something
Before the player asking someone trying to open something

Am I going about it completely wrong?

I could move the code to the action when it is being carried out by Peggy but there are reasons why Peggy cannot do something - which are in the action part of the person performing the action and there are player specific reasons this shouldn’t work and I’d like to have those in a “before the player” rule if possible.

Some insight or advice from experienced folks would be welcome.

Just delete “the player”: Before asking Peggy to try opening something:

The “Before [an actor] [doing something]” syntax doesn’t work for the “asking … to try …” action. Characters other than the player cannot perform this action.

(Even if the syntax compiled, it would likely give strange results. Say the player’s command is “ask Peggy to try opening the box”; then the “actor” global variable is immediately set to Peggy, not yourself.)

From a lot of trial and error I am now assuming this:

Check someone (called actor) opening something (called target) - this will NEVER trigger if the player does the action. It will only trigger for NPCs

Check opening something (called target) - this will ONLY trigger when performed by the player and NEVER if a NPC does it

So the player, despite being a person, is - in the sense of these actions not someone, a person, a woman - the player seems to be completely isolated fro the rest of creation in this regard. :slight_smile:

If my assumption is right I now know what to do.

(and “instead of the player asking someone” - shouldn’t it be “instead of asking someone” - strange that THIS one passes and the rest fails … so I am not 100% sure yet, I really understand it)

It looks like you’re right. This is covered in §12.14 of the documentation. “Instead of opening…” will apply only to the player, “Instead of a person [or any other description] opening…” will not apply to the player even when the player fits the description, and “Instead of an actor opening…” applies to anyone, player or not.

Also you might not want to use “called actor” because “actor” is already a global variable for whoever is doing the action–you can use a different name. Or perhaps you can use “actor” without naming the variable. But creating a temporary variable with the same name as a global variable seems like it could lead to problems…

Ah, well - local variables shouldn’t matter but I’ll make a note to avoid that. Actee sounds safe enough :slight_smile:

I’m running into slight problems with items worn by someone and items worn by me so it seems too generic a function makes for problems. I guess in case of take off I’ll do

For player related actions:
instead of taking off something (called item) worn by the player
instead of taking off something (called item) worn by someone (called wearee) who is not the player

This should allow for knowing the player is doing something and I know if the player is manipulating something on him or herself or on another person

For NPC related actions
instead of someone (called actee) taking off something (called item) worn by the player
instead someone (called actee) taking off something (called item) worn by someone (called wearee) who is not the player

This should make it easy to track who is doing it and to whom and what it is about

And similar for other actions - Hopefully this works out …

If you want to reduce the number of rules, “an actor” is useful.

Instead of an actor taking off something worn by someone (called the wearer):

Now “the actor” is the person doing the action, “the noun” is the thing being taken off, and “the wearer” is the one wearing the noun. You can check whether “the actor is the wearer” to see whether they’re taking it off their own body, for instance.