Should I be able to write a line like the following to redirect a verb to a different action when the noun is a specific thing?
Understand "wake [the Computer]"
or "wake [The Computer] up"
or "wake up [The Computer]" as switching on.
The grammar for waking restricts the action to “someone”, which is enforced by the parser before any I7 rules are evaluated. That means you can’t use a Before or Instead rule to handle waking up a colossal computer. The above line redirects the verb to the switching it on action.
This works fine until you attempt to wake another inanimate object. Instead of providing the response “You can only do that to something animate”, you get “You can’t see any such thing.”
The following illustrates:
The Lab is a room.
The Computer is a fixed in place device in the Lab.
It is switched off.
Understand "deep thought" as the Computer.
A person can be asleep or awake.
The Elephant is an animal in the Lab. It is asleep.
The Skeleton is a thing in the lab.
Understand "touch [the Computer]" as rubbing.
Understand "wake [the Computer]"
or "wake [The Computer] up"
or "wake up [The Computer]" as switching on.
Test one with "touch me /
touch elephant /
touch computer /
touch skeleton".
Test two with "wake me /
wake elephant /
wake deep thought /
wake skeleton /
touch skeleton".
Test one tests the grammar line redirecting touch to rubbing. Test two tests the grammar line redirecting wake to switching on. You’ll notice in test two that the skeleton is nowhere to be seen only when the action is waking.
Yeah, Inform is very good at considering multiple grammar lines when successfully parsing an action, but when it comes to reporting a parser error, it’s less great at figuring out which lines the error should come from. Personally I think that the [someone] grammar token is a relic of I6 that should no longer be relevant in I7; let the error messages come from check rules instead of the depths of the parser.
Yes, the problem is not animate objects but inanimate objects. Even with your grammar, attempts to wake an inanimate object result in “You can’t see any such thing.” instead of “You can only do that with something animate.”
The solution, as @Draconis suggests, is removing the “[someone]” token and adding a check rule to stop attempts to wake inanimate objects. Then you can use the normal rulebooks to change the response for specific things.
Okay, gotcha. The touching and rubbing were all just red herrings then, I see. Good puzzle?
Redirecting WAKE [inanimate device] to SWITCH ON using an Instead rule thus works since “switch” requires a device.
The way you figure it out:
Lab You can see a computer, a dog and Bob here.
actions
Actions listing on.
wake computer
You can only do that to something animate.
wake dog
[waking the dog] That seems unnecessary. [waking the dog - failed the block waking rule]
That points you to the “block waking rule” that you can de-list or rewrite if the WAKE and WAKE UP default actions are something you want to use differently.
The block waking rule is not listed in any rulebook.
It’s likely the default rule is phrased as “wake [someone]” instead of “wake [something]” which is why you’d get the “can only do that to something animate” refusal.