I have the following (abridged) code:
A person can be holy or unholy. A person is usually holy.
Understand the command "attack" as something new.
Attacking it with is an action applying to one visible thing and one carried thing.
Understand "attack [someone] with [something preferably held]" as attacking it with.
The maximum attack is a number which varies.
Setting action variables for attacking something with something:
if the second noun is a weapon:
if the first noun is holy:
let the maximum attack be the holy damage of the second noun;
if the first noun is unholy:
let the maximum attack be the unholy damage of the second noun;
now the damage dealt is a random number between 1 and the maximum attack.
But Inform 7 throws all kinds of errors, including the following:
In the sentence 'if the first noun is holy', I was expecting to read a condition,
but instead found some text that I couldn't understand - 'first noun is holy'.
I was trying to match this phrase:
if (first noun is holy - a condition):
But I didn't recognise 'first noun is holy'.
As well as:
You wrote 'let the maximum attack be the holy damage of the second noun', but when
a temporary value is created inside an 'if ..., ...' or an 'otherwise ...', it only
lasts until that line is complete - which means it can never be used for anything,
because it goes away as soon as created. To make something more durable, create it
before the 'if' or 'otherwise'.
I was trying to match one of these phrases:
1. let (maximum attack - a new name) be (holy damage of the second noun - description of relations of values)
2. let (maximum attack - a new name) be (holy damage of the second noun - name of kind)
3. let (maximum attack - a new name) be (holy damage of the second noun - value)
4. let (maximum attack - a temporary named value) be (holy damage of the second noun - value)
I recognised:
maximum attack = a non-temporary variable, holding a number
holy damage of the second noun = a property whose value is a number, holding a number
What am I doing wrong here? For context, I have defined a kind of thing
called weapon
with the properties holy damage
and unholy damage
.