Before storing action

I want to do something before the player attempts to store an object in a certain location. I can’t find the proper way to do this, every time I try it throws this error:

Problem. You wrote 'Before storing the long metal skewer in the hole' , which seems to introduce a rule taking effect only 'storing the long metal skewer in the hole'. But this does not look like an action, since there is no sign of a participle ending '-ing' (as in 'taking the brick', say) - which makes me think I have badly misunderstood what you intended.

Here is my code:

Before storing the long metal skewer in the hole: Say "You can't seem to fit it back in there."; Stop the action.

If you haven’t defined “storing” as a new action, the game won’t know what that means. The default pre-defined action for this is “inserting [something] into [something]”, so your code would become:

Before inserting the long metal skewer into the hole:
	Say "You can't seem to fit it back in there.";
	Stop the action.

Note that this uses “into” as part of the “inserting into” action. “in the hole” is more for specifying that the action is being done in a room called “the hole”.

Second, typically this type of replacement effect is done using “Instead of…”, not “Before…”. See documentation section “12.2. How actions are processed” for details. Usually you want to ensure that the player could have otherwise inserted the skewer into the hole (for instance, that he can see the hole, his hands are free, etc). If using “Instead of”, then you also don’t need “stop the action”:

Instead of inserting the long metal skewer into the hole:
	Say "You can't seem to fit it back in there.".

Alright, thanks. It runs without compile errors. However, there is one issue though.

I used this:

Instead of inserting the long metal skewer into the hole in the wall: Say "You can't seem to fit it back in there.".

And this happens:

[code]>put skewer in hole
You put the long metal skewer into the hole in the wall.

[/code]

It seems like your instead is being ignored somehow. Is there another Instead before it?

Try typing ACTIONS and then putting the skewer in the hole and see what action it is trying.

If that doesn’t seem to cause any problems, then name your Instead rule…

Instead of inserting the long metal skewer into the hole in the wall (this is the wrong tool rule): Say "You can't seem to fit it back in there.".

Then type RULES and try attempting the action. This will list every rule Inform considers on the action. If some rule allows the insertion before you get to the “wrong tool rule” and has a “rule succeeds” the parser may not be getting to your Instead.

If you’re doing that thing where you’re using INSTEAD rules to do everything instead of check/carry out like the parser expects, then every INSTEAD rule for that action before that is cutting off further parsing.

First instead of inserting the long metal skewer into the hole in the wall: Say "You can't seem to fit it back in there.".

Remember INSTEAD essentially takes control away from the parser and does what you specify. If there’s a point where the skewer needs to go in the hole, it won’t ever happen with this rule which interrupts everything else. And two INSTEAD rules won’t run together unless you specify “continue the action” in the rule. But in that case, you should be using a CHECK rule instead of INSTEAD.

Is the name of the hole in your source code “hole” or “hole in the wall”? If you have named it as “hole”, and have another object called “wall”, then Inform will misinterpret your Instead rule.

Thats it thanks!