I7: look-description when inside a container

Hi,

What I intend to do:

  • let the player enter a opaque box (container)
  • let the player “look” (as he would normally do when he enters a new room)
  • give the player a fitting description of the “room” (which is actually no room, but a container)

Code I wrote (simplified)
[code]Example Location is a room. “A nice and cozy example room.”
Blue Box is a enterable, opaque container in Example Location.

when the Player is in the Blue Box:
now the printed name of the Example Location is “Inside the blue box”;
now the description of the Example Location is “Blue, nothing but blue.”;[/code]
Of course, this doesn’t work

What I like to know:
a) is the way with changing the room description in general the right thing to do? Or is there another way to give a proper description to the “look” command while inside the box
b) if my way is basically the right thing to do, what is the correct syntax to achieve my goal? how can I handle this thing, if the box is picked up and moved to the next room, droped and the player enters the box in this room?

Thanks a lot in advance.
Jens

Your rule needs something that tells Inform when to actively fire it–this is usually “Every turn when the player is in the Blue Box:” or something connected to the action, like “Before looking when the player is in the Blue Box:”. The “when the player is in the Blue Box” is more of a passive condition that can be checked, but it alone doesn’t tell Inform when to check it and run the rule.

However, changing the name of the room isn’t really the way to go about it. For one thing, if the box is open then the player will be able to see other things in the room–so it won’t affect anything that the box is opaque. And if the box is shut and the player is inside it (and it’s lighted so the inside isn’t pitch dark), then Inform will effectively treat it as something like an extra room instead. So it will print “Blue Box” when looking instead of the room name.

If that’s fine, then you just need something to print your special message when the player is in the closed Blue Box. This can be done by adding an appropriate Carry out looking rule in the right place:

[code]Carry out looking when the closed blue box encloses the player (this is the report blueness rule):
say “Blue, nothing but blue.”

The report blueness rule is listed after the room description heading rule in the carry out looking rulebook.[/code]

Sample code and output:

[code]Top of the stairs is a room. “The top of a steep staircase.”
Blue Box is a enterable, opaque, openable container in Top of the stairs.
Blue Box can be lighted. Blue Box is lighted.
A rocking horse is in Top of the Stairs.

Bottom of the stairs is down from top of the stairs. “The bottom of a steep staircase.”

Instead of jumping in Top of the Stairs when the box encloses the player:
say “You shake the box so much it tumbles down the stairs.”;
now the box is in Bottom of the stairs.

Carry out looking when the closed blue box encloses the player (this is the report blueness rule):
say “Blue, nothing but blue.”

The report blueness rule is listed after the room description heading rule in the carry out looking rulebook.[/code]

Another thing you could do, if you want the inside of the box to be just like it was dark but with different messages, is write rules for Printing the name of a dark room and Printing the description of a dark room and Printing the announcement of darkness, and use those to print the appropriate messages:

[code]Top of the stairs is a room. “The top of a steep staircase.”
Blue Box is a enterable, opaque, openable container in Top of the stairs.
A rocking horse is in Top of the Stairs.

Bottom of the stairs is down from top of the stairs. “The bottom of a steep staircase.”

Instead of jumping in Top of the Stairs when the box encloses the player:
say “You shake the box so much it tumbles down the stairs.”;
now the box is in Bottom of the stairs.

For printing the announcement of darkness when the player is in the closed blue box: say “Now you can only see blueness.”

For printing the name of a dark room when the player is in the closed blue box:
say “Inside the Blue Box”.

For printing the description of a dark room when the player is in the closed blue box:
say “Blue, nothing but blue.”[/code]

These will have different behaviors in other ways–try putting the horse in the box, entering it, and closing it; for the first code you should be able to see the horse, for the second you won’t.

It might be easier to make the inside of the box a room. It’s still fiddly to get all the details right, but maybe less so than your way.

Top of the stairs is a room. 
Bottom of the stairs is down from top of the stairs.

Box_Interior is a room. The printed name of Box_Interior is "Inside the blue box". 
The blue box is a fixed in place thing in top of the stairs.

Instead of entering the blue box, try going inside.
Instead of exiting in Box_Interior, try going outside.

Outside from Box_Interior is top of the stairs.
After jumping in Box_Interior:
	say "You shake the box so much it tumbles down the stairs.";
	now the blue box is in bottom of the stairs;
	change outside exit of Box_Interior to bottom of the stairs;
	change inside exit of bottom of the stairs to Box_Interior;
	change inside exit of top of the stairs to nothing.

(I avoided calling the room “Inside the blue box” to avoid a potential name clash, but you can probably get away with it as long as you declare everything in the right order.)

Thanks for your input guys. Actually I adapted matt’s solution for my story. At first I thought that the inside/outside room idea might be easier, but my “box” us actually a vehicle that has to move from room to room and so I decided I’d take matt’s solution.

Anyway, thanks for the input
Jens

Ah, I don’t know if this is relevant for what you want to do, but there’s actually a vehicle kind in Inform as well. If you want the vehicle to be opaque you’d still have to do all the same things–declare it as openable and opaque, give it the lighted property, write the appropriate rules for looking or for printing the description of a dark room. (Declaring it as a vehicle automatically makes it an enterable container.) The main effect is that Inform would allow you to navigate within the vehicle by typing “north,” etc. See §3.16 of Writing with Inform.

There’s also an example in the Recipe Book for modifying the room description while inside a vehicle! See #29 “Hover”.

Thanks for your additional input guys. Maybe I will go a little bit more into detail and explain what I’m trying to do.
I’d like to have a Tank in on of my scenes. This tank has four stations (driver, gunner, loader and commander). Three of these stations have a hatch which can be closed/locked.
When you’re inside the tank you can crawl from on station to another.

Currently my code (concerning the tank) looks like this

[code]“Tank Test” by Jens Leugengroot

[GENERAL RULES]
Rule for printing room description details: stop.

[TANK]
A callsign is a kind of a value.
A tank is a kind of a vehicle. A tank has a callsign. After printing the name of a tank, say " ‘[callsign]’". Understand the callsign property as describing a tank.
A station is a kind of container.
[The carrying capacity of a station is usually one.]
A station is usually fixed in place, enterable, transparent, openable and lockable.
A hatch is a kind of thing. A hatch is part of every station.

The driver station is a kind of station. It is part of every tank.
The gunner station is a kind of station. It is part of every tank.
The commander station is a kind of station. It is part of every tank.
The loader station is a kind of station. It is part of every tank.

The Fire Control System is a kind of a thing. It is part of every gunner station.
The T-Bar is a kind of a thing. It is part of every driver station.

Understand “driver/drivers/driver’s” or “station” as a driver station.
Understand “driver/drivers/driver’s” or “hatch” as a driver station’s hatch.
Understand “commanders/commanders/commander’s” or “station” as a commander station.
Understand “commander/commanders/commander’s” or “hatch” as a commander station’s hatch.
Understand “gunner/gunners/gunner’s” or “station” as a gunner station.
Understand “gunner/gunners/gunner’s” or “hatch” as a gunner station’s hatch.
Understand “loader/loaders/loader’s” or “station” as a loader station.
Understand “loader/loaders/loader’s” or “hatch” as a loader station’s hatch.

Before opening a hatch which is part of a station (called the item):
try opening the item instead.

Before closing a hatch which is part of a station (called the item):
try closing the item instead.

Report opening a station which is part of a tank:
let txtNoun be “[the noun]”;
replace the text “station” in txtNoun with “hatch”;
say “[We] [open] [txtNoun].”;
stop the action.

Report closing a station which is part of a vehicle:
let txtNoun be “[the noun]”;
replace the text “station” in txtNoun with “hatch”;
say “[We] [close] [txtNoun].”;
stop the action.

instead of entering a station while the actor is in a station:
say “[We] crawl to [the noun].”;
move the actor to the noun.

[SETUP SCENE]
Test area is a room. “This is the test area.”

The M1A2 is a tank in Test area. The callsign is Red One.
The Player is in Test area.

Carry out looking when a driver station encloses the player (this is the report driver rule):
say “You see the drivers station.”;
stop the action.

The report driver rule is listed after the room description heading rule in the carry out looking rulebook.

Carry out looking when a commander station encloses the player (this is the report commander rule):
say “You see the commanders station.”;
stop the action.

The report commander rule is listed after the room description heading rule in the carry out looking rulebook.

Carry out looking when a loader station encloses the player (this is the report loader rule):
say “You see the loaders station.”;
stop the action.

The report loader rule is listed after the room description heading rule in the carry out looking rulebook.

Carry out looking when a gunner station encloses the player (this is the report gunner rule):
say “You see the gunners station.”;
stop the action.

The report gunner rule is listed after the room description heading rule in the carry out looking rulebook.

[/code]

What doesn’t work so far / I’m not so sure about

  • items which are dropped or put in one of the stations from the beginning (e.g. T-bar) are there, but don’t show up in the look-description
  • does this setup support dropping persons in on of the stations?
  • is this in general a good setup for my purpose?

Jens

Well the first thing I noticed is that the number 1 and the letter I look the same in the font that the IDE interpreter uses! Got a lot of “can’t see any such thing” errors from typing the I.

Implementing the stations as separate containers seems like a good idea. One of the issues that you’re having is that things that are part of other things don’t by default show up in room descriptions. That’s what’s wrong with the T-bar. Also, since the report gunner rule and similar rules end “stop the action,” that’s what’s preventing the game from printing a message about the things that you drop in stations.

I tried to make the stations opaque and lighted but I’m not getting the behavior that worked with the sample code about the box–it’s still telling me I’m in the Test Area rather than Gunner’s station. I’m not sure why.

By default you can’t pick up and drop people–if you override that behavior dropping a person should work like dropping anything else.

If this is hard to work maybe you could work it by implementing the different parts of the tank as rooms. Then when you “move” the tank you could change the outside exit of the main part of the tank.

Hi guys,

ok, I gave the other solution (stations as seperate rooms) a try and completly reworked the whole thing.

Now everything works as it shoud be. Alle stations can be entered. Descriptions are display correctly and if you exit, you get out in the correct room (where the tank acually is).

Thanks for all the help and input!

Jens

[code][Setup]
Assembly Area is south from Range 31.
Range 31 is a room.
Test area West is west of Range 31.
Test area East is east of Range 31.
Test area North is north of Range 31.

The Tank is a vehicle in Assembly Area.
Commander_Station, Gunner_Station, Driver_Station and Loader_Station are rooms.
The Commander Station, the Gunner Station, the Driver Station and the Loader Station are fixed in place containers inside the Tank.

[Commander Station]
The description of the Commander_Station is “You’re in the Commander Station.”
The printed name of Commander_Station is “Inside the Commander station”.
The Fire Control System is a fixed in place thing in Commander_Station.

[Gunner Station]
The description of the Gunner_Station is “You’re in the Gunner Station.”
The printed name of Gunner_Station is “Inside the Gunner station”.
The gunner handle is a fixed in place thing in Gunner_Station.

[Driver Station]
The description of the Driver_Station is “You’re in the Driver Station.”
The printed name of Driver_Station is “Inside the Driver station”.
The T-Bar is a fixed in place thing in Driver_Station.

[Loader Station]
The description of the Loader_Station is “You’re in the Loader Station.”
The printed name of Loader_Station is “Inside the Loader station”.

[Rules]
Instead of entering the Commander Station:
say “You climb up the tank and slide down the turret into the commanders station.”;
Move the Player to the Commander_Station;

Instead of exiting in Commander_Station:
say “You exit the Commander Station.”;
Move the Player to the location of the Tank;

Instead of entering the Gunner Station:
say “You climb up the tank and slide down the turret into the gunners station.”;
Move the Player to the Gunner_Station;

Instead of exiting in Gunner_Station:
say “You exit the Gunner Station.”;
Move the Player to the location of the Tank;

Instead of entering the Driver Station:
say “You climb the front of the tank and get into the drivers station.”;
Move the Player to the Driver_Station;

Instead of exiting in Driver_Station:
say “You exit the Driver Station.”;
Move the Player to the location of the Tank;

Instead of entering the Loader Station:
say “You climb up the tank and slide down the turret into the loaders station.”;
Move the Player to the Loader_Station;

Instead of exiting in Loader_Station:
say “You exit the Loader Station.”;
Move the Player to the location of the Tank;

Test me with “purloin tank / n / w / drop tank / enter commander station / exit”[/code]