Back at it again with another struggle against the default “you can see…”
In my game, you have a bulletin board with different messages that you can put on it or take down from it. I only want the specific details of what’s on the board to show when the player examines it directly, and not whenever they look, since there’s other stuff in the room.
I’ve tried experimenting with it so that the items are mentioned in square brackets, but since the player can take them around, they won’t always be there and that’s misleading. I also tried manipulating the scope, but that didn’t give me the result I wanted. I also don’t want the items to always be mentioned, since then they don’t come up again after they’re dropped. I even tried converting the board to a container rather than a supporter, and it prevented them from being mentioned, but the default wording and execution of it was strange.
For example, when you run it, it says:
You're in the hallway of the community center. A bulletin board hangs on the wall.
On the bulletin board are a poster, a flyer and a sticker.
You can also see a handbill here.
The “on the bulletin board…” part is what I’m trying to remove, since that should only show up if you specifically examine the board. This is the code I have; what can I add or change?
The Community Center is a room. The description is "You're in the hallway of the community center. A bulletin board hangs on the wall."
A handbill is in the Community Center.
The bulletin board is a scenery supporter in the Community Center. The bulletin board is fixed in place. The description is "A large variety of messages is posted here. You can also put something up, if you'd like.".
The poster is on the bulletin board. The description is "A poster advertising some sort of yoga fusion class.".
The flyer is on the bulletin board. The description is "A flyer saying that someone named Cecil is free to walk your dog, provided you pay him, five days a week.".
The sticker is on the bulletin board. The description is "A smiley-face sticker.".
Report taking something on the bulletin board:
say "You take down [the noun] from the board.";
Report putting an object on the bulletin board:
say "You put [the noun] up on the board." instead;
This is caused by the most controversial rule in Inform’s library, the describe what’s on scenery supporters in room descriptions rule. If you don’t want the contents of scenery supporters to be listed like this, ever, at all, you can just kill that rule.
The describe what's on scenery supporters in room descriptions rule does nothing.
But you can also work around it for this specific case. (You should be able to say that rule does nothing when working on a specific object, but it’s difficult for technical reasons: as far as I know you can’t access the arguments of an activity in a “rule does nothing” line, since they’re not global variables like “the noun” and such.)
This rule fires during the “printing a locale paragraph about” activity, and only if an unmentioned nonscenery item is on the supporter. So…
Before printing a locale paragraph about the bulletin board:
now everything on the bulletin board is mentioned.
Thank you, Daniel Stelzer, that worked! I also tried adding otistdog’s solution to my example, but that resulted in the misleading text “You can see nothing here.” showing up when everything in the room was either on the board or in my inventory.
The reason that’s only documented for specific activities is that the I6 variable parameter_object is typeless. Depending on the rulebook you’re in, it could be any integer. But then if you look at the I7 supporter/container in question variables, you’ll have an invalid value and potentially crash the game.
This shouldn’t be a problem for the “describe what’s on scenery supporters in room descriptions” rule. Just be aware of the issue.
The flipside of Zarf’s apt warning is that one can also create variables of other types that correspond to parameter_object and (with care) use them.
(When I first realized this, I had a crush on this technique and started to write activity rules that referred to a generic “parameter object” variable to save myself the bother of establishing a local variable per rule with called in the rule specification… and then I came around to called being the better usage.)
One option is to do what Inform does with “the ___ understood” and rely on the player to use the variable with the correct type for the situation:
To decide which K is the (name of kind of value K) in question: (- parameter_object -).
This isn’t perfect, because it doesn’t let you set the value to anything; “the ___ understood” gets around this by having the compiler actually create a new variable for every possible kind, which all map to the same I6 global. But it’s easier than defining a new global every time you make an activity on a new type.