A few searches didn’t turn up anything on this, though I figure it has been discussed before. I am looking at this example http://inform7.com/learn/man/ex316.html#e316 and wondering how best to modify this to my needs.
Here is a current test room code I’m working with that’s a modified version of this example:
"Hose Test" by Jizaboz
The Garden is a room. The hose is a thing in the Garden. The description of the hose is "An ordinary rubber hose[if the hose is part of something (called the parent)]. It is attached to [the parent][end if]."
A faucet is a thing in Garden. The description is "An ordinary faucet." The handle is a thing in Garden. The description is "An ordinary spray handle."
After examining something when the hose is part of the noun:
say "The hose is attached to [the noun]!"
[Here is the essential point: whenever we ATTACH HOSE TO something, it becomes part of that object.]
Instead of tying the hose to something:
now the hose is part of the second noun;
say "You attach [the hose] to [the second noun]."
[And of course the hose CAN be attached to more than one thing at a time. (But not itself)]
Instead of tying the hose to something when the hose is part of something:
if the hose is part of the second noun:
say "[The hose] is already attached to [the second noun]." instead;
otherwise:
now the hose is part of the second noun;
say "You attach [the hose] to [the second noun]."
Instead of tying the hose to the hose:
say "You can not attach the hose to itself"
Instead of taking the hose when the hose is part of something:
say "Try detaching the hose first."
[Much of the rest is just tidying to make sure that the player's commands are redirected into the right syntax.]
Instead of tying something to the hose:
try tying the hose to the noun.
Instead of putting the hose on something:
try tying the hose to the second noun.
Instead of inserting the hose into something:
try tying the hose to the second noun.
Understand the command "connect" as "tie".
Here is the result of a test play:
[code]Hose Test
An Interactive Fiction by Jizaboz
Release 1 / Serial number 111204 / Inform 7 build 6G60 (I6/v6.32 lib 6/12N) SD
Garden
You can see a hose, a faucet and a handle here.
x hose
An ordinary rubber hose.
x faucet
An ordinary faucet.
x handle
An ordinary spray handle.
attach hose to faucet
You attach the hose to the faucet.
x hose
An ordinary rubber hose. It is attached to the faucet.
x faucet
An ordinary faucet.
The hose is attached to the faucet!
attach hose to handle
You attach the hose to the handle.
x hose
An ordinary rubber hose. It is attached to the handle.
x handle
An ordinary spray handle.
The hose is attached to the handle!
[/code]
I would like the description to read “The hose is attached to the handle AND the faucet” and all variations thereof. This is something I’ve tinkered with at various times since I began learning Inform and still don’t grasp.