# How to properly write in subtraction and multiplication.??

[code]Understand “shoot [something] at [something]” as shooting it with.
shooting it with is an action applying to two things.

Check shooting it with:
if the noun is a melee weapon:
say “You can’t shoot anything with this, dummy.” instead.

Check shooting it with:
if the ammo of the noun is less than 0:
say “You are out of ammo.” instead.

Report shooting it with:
say “You fire off a round with [the noun] at the [the second noun]!”.

Report shooting it with:
if the health of the second noun is 1:
remove the second noun from play;
say “[the second noun] is destroyed.” instead.

Carry out shooting it with:
decrease the ammo of noun by 1.

Understand “attack [something] with [something]” as attacking it with.
attacking it with is an action applying to two things.

Check attacking it with:
if second noun is a range weapon:
say “You can only shoot with this! What are you? A moron?” instead.

Report attacking it with:
say “You swing [the second noun] at the [the noun].”.

Report attacking it with:
if the health of the second noun is 1:
remove the noun from play;
say “[the noun] is destroyed.” instead.

Carry out attacking it with:
decrease the decay of second noun by 1.
[/code]

These both work perfectly. However id like to add that if the thing being attacked is a person, which i have declared at the top of my code in my game (its not in this snippet) , decrease the hit points (also declared as “a person has a number called hit points”) by the damage.

``````Report shooting it with:
if the second noun is a person:
decrease the hitpoint of the second noun by damage of the first noun.``````

but that gives an error that “decrease the hitpoints…” is a phrase unrecognized

the entire numbers section of the manual goes about doing a whole bunch of cool things with numbers and equations, but i could not find how do this in it.

A person has a number called hitpoints. hitpoints is usually 100.
A range weapon has a number called damage.
(these are in my code)

Basically im asking how do i (add, subtract, multiply, divide) something with something if the somethings are not numbers. they are both previously determined as number values, and all the other (decrease decay, decrease ammo) they work fine.
any help would be great, thanks.

You’ve written “decrease the hitpoint” in your snippet above, but “A person has a number called hitpoints” in the thing you want to add. These have to be the same – you should write “hitpoints” both places (or “hit points,” or “hitpoint”; it doesn’t matter what but you have to be consistent). Also, you have “health” in the code; is that meant to be distinct from hit points?

In general, in Inform as in any other programming language, you have to be very careful about spelling and the like; the compiler doesn’t know that “hitpoints” and “hit points” are supposed to be the same thing.

It also looks to me as though your code is backwards; if you’ve declared an action as “shooting it with” then in the action “shooting the zombie with the shotgun” the zombie is the noun and the shotgun is the second noun. So you want to be checking the hit points of the noun, not the second noun.