Does a simple count mechanism exist?

I have a fragile thing which, if not taken in the presence of the correct other thing, will break.

When the player handles it the first time I give a clear warning that it is fragile and that they don’t want to do it again unless x, y, z.

If they ignore the warning and try to to the same thing again I want it to break.

Is there a simple way to count interactions of a certain kind, in this case “take item” and then reference this count to display a message.

After taking the Ming Vase for the first time: say "Ooh, this looks fragile."
After taking the Ming Vase for the second time: 
     say "Whoopsie! The Ming Vase slips out of your fingers and lands with a delicate crash.";
     Now the Ming Vase is broken. [or however you do it]


You could apply a variable. The Ming Vase has a number that varies called touchcount. and go by that.

No need, but I’ll file that variable idea away as it looks like good way to approach the issue!

That’s great, thank you.

Okay, it works perfectly but I need one more pointer on this. I have

After taking the old barrel when the rusty wheelbarrow is not in the front garden for the first time:
	say "You lift the barrel but it is so heavy and water logged that you drop it again. Dropping it like that again will surely destroy the barrel. In fact it looks ready to fall apart at any moment even if you try to roll it."
After taking the old barrel when the rusty wheelbarrow is not in the front garden for the second time:
	say "You broke it."

I also need the player to not get the barrel into their inventory. I initially had

Instead of taking the old barrel when the rusty wheelbarrow is not in the front garden:
	say "You lift the barrel but it is so heavy and water logged that you drop it again. Dropping it like that again will surely destroy the barrel. In fact it looks ready to fall apart at any moment even if you try to roll it."

I thought I might be able to incorporate the for the first time in there somehow.

You can add now the old barrel is in the location to the rule to move it back into the room. An Instead rule won’t actually pick it up, but After will.

After taking the old barrel when the rusty wheelbarrow is not in the front garden for the first time:
	say "You lift the barrel but it is so heavy and water logged that you drop it again. Dropping it like that again will surely destroy the barrel. In fact it looks ready to fall apart at any moment even if you try to roll it.";
		now the old barrel is in the front garden.
After taking the old barrel when the rusty wheelbarrow is not in the front garden for the second time:
	say "Lifting the barrel a second time you drop it almost immediately, the steel banding comes free and slices through your foot. You die.";
				end the story.

Here’s what I would actually do:

Wine Cellar is a room. "You are surrounded by barrels of wine."

some broken barrel shards are a thing. 

A flimsy-looking barrel is in Wine Cellar. "A flimsy-looking barrel in the corner looks like it's seen better days."

Instead of taking flimsy-looking barrel:
	say "[one of]You try to pick it up. It seems as though it's going to break, so you set it down. It might not be a good idea to try that again.[or]You hug the barrel and feel splintering wood...[barrel break][stopping]"
	
To say barrel break:
	say "The flimsy barrel explodes in a cloud of dust and splinters. Oops.";
	now flimsy-looking barrel is off-stage;
	now broken barrel shards are in the location.

Wine Cellar

You are surrounded by barrels of wine.

A flimsy-looking barrel in the corner looks like it’s seen better days.

x barrel

You see nothing special about the flimsy-looking barrel.

take barrel

You try to pick it up. It seems as though it’s going to break, so you set it down. It might not be a good idea to try that again.

l

Wine Cellar

You are surrounded by barrels of wine.

A flimsy-looking barrel in the corner looks like it’s seen better days.

take barrel

You hug the barrel and feel splintering wood…

The flimsy barrel explodes in a cloud of dust and splinters. Oops.

l

Wine Cellar

You are surrounded by barrels of wine.

You can see some broken barrel shards here.

take barrel

Taken.

i

You are carrying:

some broken barrel shards

I’m always cautious about triggering game actions within text, because under some circumstances text can be evaluated without being shown to the player. (I don’t think that can happen here, but it’s important to be aware of in general.)

I’d do this:

Instead of taking the barrel for the first time: say "It might break if you do that."
Instead of taking the barrel: say "It breaks! Oh no!"; end the story.

You have to think about this when writing description properties, because the library will evaluate a description to see if it’s blank.

You don’t have to worry about it for a say statement in an action rule.

(But then, if you’re writing an action rule, you could put the if directly there instead of putting it inside a “[barrel-break]” substitution.)

That’s way more efficient, but how would I include the requirement that this only applies when the rusty wheelbarrow is not present?

Just how you’d expect!

Instead of taking the barrel when the wheelbarrow is not present for the first time:

Good news, that’s what I did, bad news, I must have a different problem somewhere.

Thank you for taking the time to explain this.