Very new to Inform7 and it’s style. I have looked through the provided docs and some internet browsing has yielded nothing for me… this is a simplistic version of what i’m looking for. I want to write something like this:
breakroom is a room. "A run of the mill breakroom."
soda pop is a kind of thing. "A refreshing soda pop."
soda machine is in the breakroom. dispense button is on the soda machine.
instead of pushing dispense button:
say "A soda can dispenses".
create a soda pop (called pop) in the breakroom.
“create a soda pop (called pop) in the breakroom.” is not a valid command obviously, but I hope it conveys what I want to do. I don’t know how to instantiate objects at runtime. Can this be done reasonably? Any help would be appreciated. I am aware that there’s not a big following here for Inform but I figure i’d give it a shot.
Inform doesn’t handle dynamic objects very well, but they’re often not the best approach anyway. Section 10.3. Dispensers and Supplies of Small Objects in the manual may be helpful.
I think the best model for this is a physical one: create a limited supply of cans in the machine. For example:
(make the machine
opaquerather thantransparentif you prefer!). In the above, I’ve also tweaked the description of a soda pop — if you just say"Blah"rather thanThe description is "Blah"after an object definition, you set the initial description (printed as part of the room description) rather than the “examine” description, which I don’t think is what you want here — and I’ve made the button a “part” of the machine, rather than a separate object.The result: