Inform 7 timers and radiation

Hi, I’m new to writing in Inform 7. I have a scenario that I would like to design into a game, and I wonder if anybody has a suggestion for the right way to implement it? The scenario is this:

The player puts on a radiation suit. They enter a nuclear reactor. This is a series of rooms that are filled with radiation. The player has to solve a puzzle to shut down the reactor before the radiation kills them. They have X number of turns to do it. If they exceed X turns while exposed to radiation, they die.

I remember playing Infocom’s “Cutthroats” game, where the player goes scuba diving, and they can run out of air. This seems pretty similar to me… I imagine there is a timer involved for the build-up of radiation, in the same way that the player’s air tank ran out after a certain time underwater in Cutthroats?

Can someone please give me a kick in the right direction for implementing this code? Thanks for your time and assistance.

The suit has a number that varies called damage. Every turn near the danger zone damage increases and checks if it’s greater than the max radiation. If so, end the story.

If you want, similarly every turn when damage is more than zero and the player is away from the zone you could decrease damage so radiation will fade away.

I’m on my phone so that’s a simple overview. I’ll give a code example later if nobody else jumps in.

I think you would want to create a dosage property for the player. This can be a simple number if you are only tracking turns or even a new type of unit (e.g. millirems) if you want to get fancy and calculate specific amounts.

Similarly, you would want to create a radioactive property for things and/or rooms. Again, you can get fancy with things like scope checking and rules to determine the dosage received under various circumstances (e.g. if the chunk of radioactive material is on the ground, in an open lead box, in a closed lead box), but you may not want that.

Here’s a very simple scenario:

[code]“Example”

The player has a number called cumulative dosage. [This will default to zero.]

A room can be radioactive.

Safety Vault is a room. “You are safe from radiation here.”

The Core is a radioactive room. “Radiation levels are dangerous here.” It is east of Safety Vault.

To decide whether the player is receiving radiation:
if the player is in a radioactive room, decide yes;
decide no.

Every turn when the player is receiving radiation (this is the radiation exposure increases dosage rule):
increment the cumulative dosage of the player.

Every turn when the cumulative dosage of the player is at least 4 (this is the too much radiation kills rule):
end the story saying “You succumb to the effects of radiation poisoning.”

test me with “showme me / e / showme me / z / showme me / z / z”
[/code]

Thanks guys for your help! I appreciate the input. I like the idea of the radiation suit being like armor that takes damage. However, I think the idea of the counter as otistdog suggested fits the situation best. The player receives more radiation every turn, and thus the counter goes up. When the counter reaches a certain number, bad things happen.

Cheers!