Hello, all! Newbie here, taking advantage of quarantine to get to know Inform–something that’s been on my to-do list for a long time.
Here’s the question, with apologies up-front if the answer is really simple …
I have a room–an outdoor location. In the distance, there’s a ship. The ship is a backdrop, because it’s visible from various other rooms, and I’d like to handle it in the room descriptions rather than as a separate object.
“Examine ship” produces the right response, but commands like “go to ship”, “board ship”, “take ship”, etc. produce various unhelpful stock responses.
I’ve experimented with making a rule, but can’t get it to work. “Instead of going to the ship …”, for example, produces an error indicating that the ship is a backdrop, and not a thing to go to.
I’d like to tell Inform how to respond if the player tries to treat this backdrop as a room, a thing, etc. How do I go about this?
You want to use the ACTIONS debugging command to see what actions are being generated, so you know what rules to write.
>actions
Actions listing on.
>go ship
[entering the ship]
That's not something you can enter.
[entering the ship - failed the can't enter what's not enterable rule]
>enter ship
[entering the ship]
That's not something you can enter.
[entering the ship - failed the can't enter what's not enterable rule]
This indicates that you can write a rule like:
Check entering the ship:
instead say "It's too far away.";
I use this code from the examples in all of my games. It creates a new kind of backdrop called a “view” for far away scenery objects:
A view is a kind of backdrop.
The can't touch views rule is listed before the access through barriers rule in the accessibility rulebook.
Accessibility rule (this is the can't touch views rule):
if the action requires a touchable noun and the noun is a view:
say "You are too far from [the noun] to do anything but look." instead;
if the action requires a touchable second noun and the second noun is a view:
say "You are too far from [the second noun] to do anything but look." instead.