newb Inform 7 question

I’m trying to make a spray can. I pulled the code for the spray can itself from the example on making an item that breaks when shot and that works fine, but I can’t seem to find any instruction on how to limit the amount of paint or break the can when used (either one will work since it is only meant to be used once). Can anyone point me in the right direction?

I’m not sure which example you’re talking about (was it from the Inform 7 manual? Can you provide the example number?) However, it sounds like you essentially want a device that works once and then stops. One way to do that would be to create an either-or property for the item, and then check that property when the player tries to use it.

[code]Tagging it with is an action applying to one thing and one carried thing.
Understand “tag [something] with [something preferably held]” as tagging it with.
Understand the command “spray” or “paint” as “tag”.

The Art Studio is a room.

The spray can is in the Art Studio. The spray can can be full or depleted. The spray can is full.

Check tagging something with the depleted spray can:
say “Sorry, the can is empty.”;

Carry out tagging something with the spray can:
now the spray can is depleted.

Report tagging something with the spray can:
say “You spray a quick throw-up onto [the noun].”[/code]

The first time you use the spray can, the check rule is skipped, because the can starts out as full, not depleted. Immediately after that, however, the carry out rule changes the can’s state to depleted. So the next time you try to use it, the check rule will apply and stop the action with an appropriate message.

EDIT: fixed the the tagging action, and changed “empty” to “depleted”, since “empty” already has a meaning in the standard rules.