Now here is a nice parser puzzle for you all. It is a modified version of Technological Terror from the official documentation.
What I would like is SHOOT GUN to be understood as “shoot with the gun at something” when I am holding the gun, but to be understood as “shoot at the gun with something” if I am not. Basically I want both SHOOT GUN and SHOOT RIFLE to be a sensible command to defend ourselves against the killer robot in the example.
No amount of “Does the player mean” or “Rule for supplying a missing second noun” or new grammar lines seems to get this right. Does anyone have an idea?
[code]“Technological Terror mk.2”
A pistol is a kind of thing.
The Decomposition Ray Gun is a pistol carried by the player.
[First we need to define our shooting action:]
Shooting it with is an action applying to one thing and one carried thing.
Check shooting something with something:
if the player is not carrying a pistol, say “You are pathetically unarmed!” instead;
if the second noun is not a pistol, say “[The second noun] does not fire.” instead;
if the noun is the second noun, say “Nice trick if you can do it!” instead;
if the noun is the player, say “That would be disastrous!” instead.
[Next, some grammar to allow the player to use this action:]
Understand “shoot [something] with [something]” as shooting it with.
Understand “shoot [something] at [something]” as shooting it with (with nouns reversed).
Carry out shooting something with something:
say “ZAP! [The noun] twinkles out of existence! [if something is part of the noun][The list of things which are part of the noun] clatter to the ground! [end if][paragraph break]”;
now every thing which is part of the noun is in the location;
now the noun is nowhere.
The Deathbot Assembly Line is a room. “Here is the heart of the whole operation, where your opponents are assembled fresh from scrap metal and bits of old car.” The dangerous robot is a person in the Assembly Line. “One dangerous robot looks ready to take you on[if the robot carries the laser rifle] with its laser rifle[end if]!” A robotic head, a drill arm, a needle arm, a crushing leg and a kicking leg are parts of the dangerous robot.
The Laser Rifle is a pistol carried by the dangerous robot.
Instead of examining something when something is part of the noun:
say “[The noun] consists of [a list of things which are part of the noun]. [if the noun carries something][The noun] carries [a list of things carried by the noun].[end if]”
Test me with “x robot / shoot gun / shoot rifle”.[/code]