I am a little new to IF, but have had lifelong experience in programming in general. I stumbled across Inform7 in a totally unrelated search, so now I have been playing with it for the last few days, and I feel like I am picking it up fairly quickly. Forgive me if my question is in the documentation or answered elsewhere, but I can not seem to find the answer.
Containers seem to by default report their status as empty or containing items. (e.g. “You can see a trash can (empty) here.”) How do I duplicate the same effect for other properties (especially custom properties) of other objects or kinds?
In my test script, I have the following set up and working:
- I added that: “A thing can be useful or useless. It is usually useful.”
- “A ladder can be folded or unfolded. It is usually folded.” and later on “The stepladder is a ladder.”
- a trash can.
- You can make things useless by bashing them (with your fists? Just pretend you have special fists…)
The following logic applies, and currently works to these effects:
- If the stepladder is folded, you cannot stand on it. You can only stand on it in its unfolded state.
- If you bash it while it is folded, it becomes useless, you cannot unfold it, ergo you will not be able to stand on it.
- If you bash it while it is unfolded, it becomes useless, you will not be able to fold it. You will be able to stand on it (unfolded), however, if you risk standing on it, because it is now damaged its ability to support you has been compromised, and you fall, break your neck, and die. (Harsh, I know, but you shouldn’t bash ladders and then expect them to work.)
- If the stepladder is useful, you cannot put it in the trash can.
- If the stepladder is useless, then it may be put in the trash can… as long as you haven’t bashed the trash can and made it useless.
So depending on what state things are in, I’d like those important details reflected in the name as adjectives instead of having to examine the item to find out the state (which I have rules for examining.) I’d like to be able to see “You can see a damaged trash can, and a damaged stepladder.” which seems would be a simple matter of concatenating “useless” into the printed name of the thing.
I suspect that the change should take place once the item has been bashed, somewhere in this part of the script:
[code]Bashing is an action applying to one thing. Understand “bash [something]” as bashing.
Carry out bashing something (called whatever):
say “[The whatever] is no match for your bare fists and you successfully beat the tar out of it.”;
[right here we should somehow change the printed name… like “now the printed name of whatever is”… ???]
now whatever is useless.
Thanks in advance…