[I7] Numbers for every person and radioactivity. -SOLVED

I am still trying to understand rules that apply to characters other than the player. I am working on the “an actor” stuff, but right now, I am having a problem with numbers. Lets say I have a radioactivity number for each person. There’s a bunch of glowing carbon rods lying around, which the player and NPCs have to use for light sources.

Every turn: If an actor is holding a carbon rod: now the radioactivity of the actor is the radioactivity of the actor plus one;

This doesn’t work for a couple of reasons, but I hope you can see where I am trying to go with this.

Actually, the “actor” syntax is only dealing with actions, but you’re testing a condition. What you want to do is loop through every person and run this code if it applies to them, so you need the “repeat … running through” construction.

Every turn: repeat with agent running through people holding carbon rods: now the radioactivity of the agent is the radioactivity of the agent plus one;

You can also do this.

Every turn: repeat with agent running through people holding carbon rods begin; increment the radioactivity of the agent; end repeat.

Inform allows “increment (number)” and “decrement (number)” when changing a number by one. It also allows “increase (number) by (number)” and “decrease (number) by (number)” for changes that are not one.

You could even do it like this.

[code]Definition: a person is carbonated rather than uncarbonated if they carry a carbon rod.

Every turn:
repeat with agent running through carbonated people begin;
increment the radioactivity of the agent;
end repeat.[/code]

Here you can define a new adjective that that can be used many times over.

Hope this helps.