Help with a modified action

I’ve put this in for my code:
Instead of punching Guards: say “[If player has Spirit]Words will do you no good here, so instead…[paragraph break] You punch the burly guard with all your might. (You’re pretty sure the only reason he actually was moved was because you caught him off guard) All noise stops outside the base entrance.[paragraph break] ‘What the hell! Who do you think you are? I oughta’ Uh-oh, you’re done for now. ‘Wait,’ the man holds her back then looks down at you, ‘that took guts. Gang 2 kinda guts. Go on inside if you’re serious about joining. But one wrong move and I will deal with you personally.’[otherwise] You’re about to wind up and punch, but you become unsure of your action and don’t follow through.[end if]”.

But get an error message: Problem. You wrote ‘Instead of punching Guards’ , which seems to introduce a rule taking effect only if the action is ‘punching Guards’. But that did not make sense as a description of an action. I am unable to place this rule into any rulebook.

If I replace “punching” with “pushing” or “attacking”, the game will compile but when the player gets to that point and says to attack or push guards, there is no output text for the action. How can I fix this?

There is no standard ‘punching’ action. The command PUNCH by default triggers the ‘attacking’ action. So you should make that an ‘instead of attacking the guards’ rule.

As to why it doesn’t fire, I don’t know. It should. If you use the command RULES when testing your game in the IDE, Inform will go into one of its debug modes. If you then type PUNCH GUARDS, Inform will list all rules the game considers when it decides how to respond to that command (on that occasion). The last rule in that list is likely to be the one that messes with the output.