hopeless

So, I have this following piece of code:


"argh"

include the inform ATTACK by Victor Gijsbers.



a body part is a kind of thing.
a body part can be intact or severed.
a body part is usually intact.
[a body part is usually singular-named and proper-named.]
a body part has a number called resilience.
resilience of a body part is usually 1.

left arm is a kind of body part.

a humanoid is a kind of person.
a body part (called left arm) are part of every humanoid.
a body part (called right arm) are part of every humanoid.
a body part (called left leg) are part of every humanoid.
a body part (called right leg) are part of every humanoid.
a body part (called torso) are part of every humanoid.
a body part (called groin) are part of every humanoid.
a body part (called head) are part of every humanoid.


understand "aim [who] at [what]" as aiming.
aiming is an action applying to two things.
the aiming action has an body part called what (matched as "at").


check aiming:
	take no time.
	if the noun is not a humanoid:
		say "You can aim only opponents" instead.
[	if the second noun is not a body part,
		say "[noun] has no [second noun]" instead.
]		


Carry out aiming with second noun as a body part:
	take no time.
	now what is severed.
	now what is in the cave.
	
		
report aiming:
	say "You sever it!".
		
		

The goblin is a humanoid.

the cave is a room. The player is in the cave.
The health of the player is 20.
The player carries a sword.

The goblin is in the cave.  The goblin carries a mace.The melee of the goblin is -1. The goblin is hostile.

compiler says:

This is the report produced by Inform 7 (build 6G60) on its most recent run through:


Problem. You wrote 'the aiming action has an body part called what (matched as "at")'  , but 'what' already has a meaning, which this would clash with.
 

Am I missing something, since as I see ‘what’ is not defined anywhere else.

The word “what” is used (interchangeably with “which”) to define new ‘phrases to decide’ (as in section 11.17 in the Documentation, which illustrates this use with “To decide what number is the target score: …”). That’s probably why it can’t also be used as a variable.

Nope. Exchange ‘what’ with any other word and you’ll get the same.

You have several other issues with the code that somehow lead to the compiler complaining about that line, which itself should be ok. First, you should change the aiming action’s grammar to

Understand "aim [something] at [something]" as aiming.

(“who” and “what” aren’t allowed grammar tokens.)

Secondly, you are terminating sentences with a full stop inside a rule. Only the last sentence of a rule should end in a full stop, all others should end in a semicolon.

[code]Check aiming:
take no time;
if the noun is not a humanoid:
say “You can aim only opponents” instead.

Carry out aiming at a body part:
take no time;
now what is severed;
now what is in the cave.[/code]
With these changes the code should compile, but there are still problems with it so that it probably won’t function as you inted it to; for example, the body part is never assigned in the aiming action. You could drop the action variable completely, name the action “aiming it at” and check if the second noun is a body part (just like you do when you check if the noun is a humanoid).