Having issues!

I’m trying to set this up so that after an NPC gets angry their anger cools down based on their “niceness” rating, but it won’t work!
The code is as follows:

Every turn: if the anger of a person (called the angered) is greater than 0: if a random chance of the niceness of the angered in 20 succeeds: decrease the anger of the angered by 1.

but it keeps returning the message:

[code]Problem. In the sentence ‘if the anger of a person (called the angered) is greater than 0’ , it looks as if you intend ‘anger of a person (called the angered)’ to be a property, but ‘a person’ is not specific enough about who or what the owner is.

Sometimes this mistake is made because Inform mostly doesn’t understand the English language habit of referring to something indefinite by a common noun - for instance, writing ‘change the carrying capacity of the container to 10’ throws Inform because it doesn’t understand that ‘the container’ means one which has been discussed recently.

I was trying to match this phrase:

if (anger of a person ( called the angered ) is greater than 0 - a condition):

I recognised:

anger of a person ( called the angered ) is greater than 0 = a condition
[/code]

Thank You!

Try this

Definition: a person is angry if their anger is greater than zero. Every turn: repeat with the subject running through angry people: if [etc]
You generally need a repeat-loop if you want to affect everything matching a condition.

I did what you said and it fixed my first problem but now it says:

[code]Problem. In the sentence ‘Definition’ , I was expecting to read a number, but instead found some text that I couldn’t understand - ‘niceness of the subject’.

I was trying to match this phrase:

a random chance of (niceness of the subject - number) in (20 - number) succeeds

But I didn’t recognise ‘niceness of the subject’.

Because of this problem, the source could not be translated into a working game. (Correct the source text to remove the difficulty and click on Go once again.)
[/code]

It recognizes that niceness of the subject is a number but still says it couldn’t find a number, why?!!

Code:

[code]Definition: a person is angry if their anger is greater than 0.

Every turn:
repeat with the subject running through angry people:
if a random chance of the niceness of the subject in 20 succeeds:
decrease the anger of the subject by 1.
[/code]

It’s saying it expected a number there, but didn’t find anything understandable. Are you sure “niceness” has been defined?

This works for me:

Home is a room.

A person has a number called anger.
A person has a number called niceness.

John is a man in Home with anger 10 and niceness 10.
Marsha is a woman in Home with anger 5 and niceness 5.

Definition: a person is angry if their anger is greater than 0.

After printing the name of a person (called P):
	say " (anger [anger of P])".

Every turn:
	repeat with the subject running through angry people:
		if a random chance of the niceness of the subject in 20 succeeds:
			decrease the anger of the subject by 1;
			say "[The subject] cools off a little."

Are you sure your niceness property is defined correctly?

Ooooooooh, I had defined the numbers in a table but had forgotten “a person has a number called niceness”! I knew it was some stupid mistake!

Thanks!