This will be explored more in subsequent examples, but one of the things we can do with carry out rules is extend the function of existing commands so that they do more, or have special effects in specific situations. For instance, suppose we want to have a class of electric light:
"The Dark Ages Revisited"
An electric light is a kind of device. Carry out switching on an electric light: now the noun is lit. Carry out switching off an electric light: now the noun is unlit.
This will not affect the behavior of any other devices when switched; it will also not change the way in which switching lights on and off is reported. The player will still see "You switch the sodium lamp on." or the like. In this case that is probably what we want. If we wanted a special way of describing turning on electric lights as opposed to all other devices, we could also add an after rule for the electric light class. Adding this rule to the carry out train does guarantee, though, that in no case will we manage to make the lamp lit without actually making it switched on (or vice versa).
The Stooped Corridor is a room. "A low, square-cut corridor, running north to south, stooping you over."
The sodium lamp is an electric light in the Stooped Corridor. "[if switched on]The sodium lamp squats on the ground, burning away.[otherwise]The sodium lamp squats heavily on the ground.[end if]". The description is "It is a heavy-duty archaeologist's lamp, [if switched off]currently off.[otherwise]blazing with brilliant yellow light.[end if]"
Instead of burning the sodium lamp, try switching on the lamp.
So far so easy. Since we've built the description of its light or darkness into the lamp's description, though, we may want to get rid of the "...is switched on" line that automatically follows when we look at something. For this we do need to borrow from a later chapter:
The examine devices rule is not listed in the carry out examining rules.
Test me with "x lamp / switch lamp on / look / x lamp".
"Reflections"
Behind the Waterfall is a room. "Though one wall of the cave is open to the waterfall, the quantity of water is so great that barely any light comes through from the outside." Behind the Waterfall is dark.
Surface is a kind of value. The surfaces are shiny and dull. A thing has a surface. A thing is usually dull.
The player carries a reflecting ball, a canopic jar, an abacus, a plumbline, a piece of chalk, and a torch. The reflecting ball is shiny.
Aladdin's lamp is a shiny thing in Behind the Waterfall.
Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing. The torch has a brightness. The torch is blazing. The torch is lit.
Understand "blow out [something]" or "blow [something]" or "extinguish [something]" as blowing out. Blowing out is an action applying to one thing.
Carry out blowing out: say "Futile."
Instead of blowing out the torch:
now brightness of torch is the brightness before the brightness of the torch;
say "The light of the torch dies to [brightness of torch]."
Instead of blowing out the guttering torch:
say "Fool! Do you want to put it out entirely?"
Rule for writing a paragraph about a shiny thing:
say "The [brightness of the torch] light of [the torch] reflects in the surface[if the number of shiny things in the location > 1]s[end if] of [the list of shiny things in the location]."
Before printing the name of the torch while writing a paragraph about something:
if the torch is in the location, say "fallen ".
Test me with "drop ball / look / blow torch / look / drop torch / look".
Suppose we have a situation where the player is in darkness, but is allowed to feel and interact with (except for examining) any large objects. In that case, we write a scope rule that puts those large objects into scope all the time, and trust the "requires light" aspect of verbs like examining to prevent the player from doing any actions that he shouldn't:
"Peeled"
A thing can be large or small.
Before touching a large thing when in darkness: say "You grope for [the noun]..."
After deciding the scope of the player:
repeat with item running through large things in the location:
place item in scope.
Some generic surroundings are backdrop. They are everywhere. Understand "walls" or "wall" or "ceiling" or "ground" or "floor" or "area" or "room" or "here" as the generic surroundings. Instead of touching the generic surroundings: say "You encounter nothing extraordinary." Instead of touching the generic surroundings when in darkness: say "You try feeling your way around and reach [a list of large things in the location]." After deciding the scope of the player when in darkness: place the surroundings in scope.
The Room of Mystery is a dark room. The bearskin rug is a large thing in the Room of Mystery. Instead of touching the rug: say "It feels furry!"
The peeled grape is a small thing in the Room of Mystery. Instead of touching the peeled grape: say "Gosh, is that an eyeball?"
Test me with "feel floor / feel rug / eat rug / examine rug / get grape".
Sadly, because the grape is small, the player will never encounter this horror.
Alternatively, suppose we have a situation in which the player can use one command to interact with a kind of thing that isn't normally in scope. It's usually most convenient to write the "understand" rule appropriately rather than use the scope activity.
(Note that we define "inquiring about" as applying to one *visible* thing; otherwise we would be required to be able to touch the catsuit in order to inquire about it. More on this restriction may be found in the Advanced Actions chapter on the topic of visible, touchable, and carried things.)
"Peeled"
Mr Steed's Flat is a room.
Understand "ask about [any subject]" as inquiring about. A subject is a kind of thing. The skintight catsuit is a subject. Inquiring about is an action applying to one visible thing.
Carry out inquiring about something:
say "'What can you tell me about [the noun]?' you demand. Mr Steed raises his eyebrows, but does not reply."
Test me with "ask about catsuit / x catsuit".
All this said, there do arise certain complex situations when we want an activity-specific scoping.
Suppose we want to have a room with a light switch. Turning the switch off makes the room go dark; turning it on restores the light. This kind of switch is an obvious candidate as a device.
"Down Below"
Terrifying Basement is a room. The light switch is a switched on device in the Terrifying Basement. It is fixed in place.
Here we define our light switch, and we also make it start out as "switched on". The Terrifying Basement will also start out lit (as all rooms do, by default, unless we specifically say that they are dark). We further say that it is fixed in place to avoid the ludicrous possibility of the player picking it up and carrying it away.
Next we add some instructions to control how turning the light switch on and off affects the room light. These borrow from later chapters on actions, but the gist may be obvious anyway:
Carry out switching off the light switch: now the Terrifying Basement is dark.
Carry out switching on the light switch: now the Terrifying Basement is lighted.
Inform already has the idea of light and darkness built in; we will see more about this later, and the Phrasebook (in the Index tab) also contains a list of all the adjectives (lighted, dark, etc) which are important to use here.
Speaking of the Index, the Actions tab contains a list of all the grammar that can be used to activate a given command: for instance, the switching action responds to "switch [something]" or "turn on [something]". In this case, we may want to give the player an extra option or two. It would be pretty natural for a player to try >FLIP SWITCH, so let's add that in:
Understand "flip [something switched off]" as switching on. Understand "flip [something switched on]" as switching off. Understand "flip [something]" as switching on.
The nuances of this will be explored in the chapter on Understanding. What is useful to know here is that we have taught Inform to understand that >FLIP LIGHT SWITCH means to turn it on when the switch is already off; if the switch is already on, FLIP SWITCH means to turn the switch off. Depending on the kind of device we are modeling (button? lever? dial?), we might want to write similar lines for commands such as PUSH, PRESS, PULL, TURN, and so on.
Finally, we need to deal with a special case. In general, the player cannot interact with other things in a dark room because he can't see them, but if we adhered strictly to this it would be impossible for him to find the light switch to turn it back on. So we need something from the chapter on Activities to change this:
After deciding the scope of the player when the location is the Terrifying Basement:
place the light switch in scope.
Upstairs is above the Terrifying Basement.
Test me with "turn off light / look / flip light switch".
"Undertomb 2"
Section 1 - Procedure
Brightness is a kind of value. The brightnesses are guttering, weak, radiant and blazing.
A brightness can be adequate or inadequate. A brightness is usually adequate. Guttering is inadequate.
Temperature is a kind of value. 100C specifies a temperature.
A brightness has a temperature. The temperature of a brightness is usually 700C. The temperature of blazing is 1400C. The temperature of radiant is 1100C.
A dead end is a kind of room with printed name "Dead End" and description "This is a dead end, where crags in the uneven rock are caught by the [brightness of the lantern] flame you hold aloft. Despite [river sound] there is no sign of the stream." A dead end is usually dark.
A dead end has some text called river sound. The river sound of a dead end is usually "a faint whispering of running water".
Section 2 - Scenario
The Undertomb is a dark room. "From this dim cross-groined room, exits depart east, south, and northwest."
East is a dead end. South is a dead end with printed name "Collapsed Dead End".
Northwest is a dead end called the Tortuous Alcove. The Tortuous Alcove has river sound "a gurgle of running water".
The player carries a book. The description of the book is "[if the brightness of the lantern is adequate]Many secrets are now yours.[otherwise]No, the print's too tiny by this awful light."
In the Undertomb is a lantern. It is lit. The lantern has a brightness. The lantern is blazing. The description of the lantern is "The lantern shines with a flame at [temperature of the brightness of the lantern]."
After waiting in the Tortuous Alcove when the brightness of the lantern is not guttering:
now the lantern is the brightness before the brightness of the lantern;
say "You wait so long that your lantern dims a bit."
Test me with "east / west / get lantern / east / west / south / north / northwest / read book / x lantern / z / x lantern / read book / look / z / x lantern / read book / look / z / x lantern / read book / look".
Inform automatically keeps track of light and darkness, handling such questions as whether a room is lit, whether the player can see any light sources, etc., and then managing the descriptions accordingly. When the room is dark and no light sources are visible, the player is said to be "in darkness".
If we don't specify otherwise, Inform will describe our surroundings in a dark room thus:
Darkness
It is pitch dark, and you can't see a thing.
This is fine in many situations, but we may sometimes want to replace this phrase with something else.
"Hohmann Transfer"
The Western Hemisphere is a dark room. "The cloud mass covers much of the land on this side of the planet, and a particularly nasty storm is brewing off to the south."
The Eastern Hemisphere is west of the Western Hemisphere. The Eastern Hemisphere is east of the Western Hemisphere. The Eastern Hemisphere is north of the Western Hemisphere. The Eastern Hemisphere is south of the Western Hemisphere. "This side of the planet is more ocean than land, with only two continents worthy of the name, and a volcanic archipelago in the north seas."
Use full-length room descriptions.
Rule for printing the description of a dark room:
say "It's night on this side of the planet, so you can make out only the glow of urbanized areas along the seacoasts." instead.
Rule for printing the name of a dark room:
say "Dark Side" instead.
And now a few minor refinements so that we can see what happens when one room becomes dark and the other light:
Carry out going:
say "You fire the thrusters and loop around to the other side of the planet before settling into a new geosynchronous orbit. Six months and one minute later..."
The time of day is 4:55 PM.
At 5 PM:
now the Eastern Hemisphere is dark;
now the Western Hemisphere is lit.
Rule for printing the announcement of darkness:
say "The planet abruptly spins itself over, exposing its cool underbelly to the sun."
Test me with "e / z / z / w / z / z / e".
Suppose we're simulating a situation where the player needs to travel through lit areas only, but we want to give him some hints about which way might be safe. Here we'll find our best route through light-filled rooms.
The slightly tricky part is that it's not necessarily easy to tell whether a room has a lamp in it. We may say "if the Crypt is lighted", but that only tells us whether it has been declared to be inherently lighted or dark, not whether it happens to contain a light source that the player would be able to see if he went in.
The easiest way to get around this is to create an object -- the light-meter; place it in the target location; and check whether it "can see" a lit object. This preserves all the usual rules about open and closed containers, transparency, etc.
"Unblinking"
Section 1 - Procedure
The light-meter is a privately-named scenery thing.
Definition: a room (called the target room) is light-filled:
if the target room is lighted:
yes;
move the light-meter to the target room;
let the answer be false;
if the light-meter can see a lit thing:
now the answer is true;
now the light-meter is nowhere;
decide on the answer.
That done, we're free to use our best-route phrases to choose a particular route.
Section 2 - Scenario
The Tomb of Angels is a room. "This ancient underground tomb is lightless but for a few shafts from the surface. Everywhere in the shadows are carved angels, their faces worn away by water and pollution, their wings little more than nubs."
The Upward Path is above the Tomb of Angels. It is dark. "The staircase switches back on itself many times as it ascends towards the Crash Site."
A container called the sarcophagus is in the Upward Path. It is closed and openable. "A sarcophagus rests in the niche here, [if open]the lid pushed aside[otherwise]the lid firmly in place[end if]."
The Crash Site is above the Upward Path. "The ceiling has wholly caved in here, and the belly of the spaceship above you is visible -- including the escape hatch."
A candle is a kind of thing. A candle is usually lit. The player carries four candles.
After looking when the location is not the Crash Site:
if the best route from the location to the Crash Site through light-filled rooms is a direction (called next way):
say "It looks like there's a safe, lit path [if the number of moves from the location to the Crash Site through light-filled rooms is 1]straight[otherwise]if you go[end if] [next way].";
otherwise:
say "It looks like there is no fully lit path from here to the Crash Site."
Test me with "up / drop candle / down / up / take the candle / open sarcophagus / put candle in sarcophagus / down / up / close sarcophagus / d".
An important word of caution: this method would give false negatives if there were a backdrop lightsource, such as the moon, providing light to the Upward Path. This is because backdrops are actually moved around the map by Inform during play, following the player around. So if the moon backdrop is in the Crash Site with the player, it will not be in the Upward Path as well -- even if it's scheduled to move there as soon as the player does.
"Zorn of Zorna"
Visibility rule:
if examining:
if the detail of the noun is fine and the number of visible lit candles is less than 5, there is insufficient light;
if the detail of the noun is ordinary and the number of visible lit candles is less than 3, there is insufficient light;
there is sufficient light.
Detail is a kind of value. The details are fine, ordinary, and gross. A thing has detail.
A candle is a kind of thing. Before printing the name of a candle while not burning or blowing out: say "[if lit]lit [otherwise]unlit [end if]". A candle is usually lit. Before printing the plural name of a candle while not burning or blowing out: say "[if lit]lit [otherwise]unlit [end if]". A candle is usually lit. Understand the lit property as describing a candle. A candle is usually gross.
Instead of burning a candle: now the noun is lit; say "You light [the noun]."
Understand "blow out [something]" or "extinguish [something]" or "put out [something]" as blowing out. Understand the command "snuff" as "extinguish". Blowing out is an action applying to one thing.
Understand "burn [unlit candle]" as burning.
Instead of blowing out a candle:
now the noun is unlit;
say "You put out [the noun]."
Rule for printing a refusal to act in the dark:
if we are examining something, say "The details of [the noun] are too fine to make out in the light of only [the number of visible lit candles in words] candle[s]." instead.
Every turn when the Todal is visible:
if the number of visible lit candles is greater than 1:
say "The brightness of the room wakens the Todal from slumber, and with you unarmed...";
end the story;
otherwise:
say "Todal sleeps fitfully, troubled by even that faint light."
A room is usually dark.
The Palace is a room. "The Duke is out; the way is clear. East is Saralinda's Chamber; north, a hallway zigs and zags down to the gate that leads out." A finely-written placard is in the Palace. "A finely-written placard is on the wall next to this exit." The placard is fine. The description of the placard is "You read: 'Beware the Todal: its bite is worse than its gleep.
No more than one candle!'"
The candle-stand is a supporter in the Palace. Understand "stand" as the candle-stand. The description of the candle-stand is "The candle-stand is a tall metal branch for holding lights, but someone has quite practically added casters to the bottom." It is pushable between rooms. Three candles are on the candle-stand. Instead of removing something from the candle-stand: say "[The noun] is fixed quite firmly in place." Instead of taking something which is on the candle-stand: say "[The noun] won't come out of the holder." Instead of putting something on the candle-stand: say "[The candle-stand] is full."
Saralinda's Chamber is east of the Palace. "Now that Saralinda herself is gone, there is no real radiance in this place." Two unlit candles are in Saralinda's Chamber.
A large-print romantic novel is in Saralinda's Chamber. The novel is ordinary. The description of the novel is "'She Was Only The Chimney-Sweep's Daughter', by Marie Swelldon."
The Zig-Zag Hallway is north of the Palace. "The Hallway goes left, then right, then left again..." Two unlit candles are in the Hallway.
Todal is an animal in the Zig-Zag Hallway.
Rule for printing the description of a dark room when the Todal is in the location:
try listening.
Instead of listening when in darkness and the Todal is in the location:
say "In the darkness something softly gleeps."
Instead of going north from the Hallway when in darkness:
say "You stumble and cannot find your way."
North of the Hallway is Freedom. Instead of going to Freedom: say "You make it out into the cool night air at last!"; end the story finally.
Test me with "examine placard / get placard / n / listen / n / s / examine candle-stand / push candle-stand east / examine novel / get unlit candle / light it / light unlit candle / examine placard / push candle-stand west / e / examine novel / w / n / n".
"Four Stars"
A thing has some text called sound. The sound of a thing is usually "silence".
The report listening rule is not listed in the report listening to rules.
Carry out listening to something:
say "From [the noun] you hear [the sound of the noun]."
Instead of listening to a room:
if an audible thing can be touched by the player, say "You hear [the list of audible things which can be touched by the player].";
otherwise say "A merciful peace prevails."
Definition: a thing is audible if the sound of it is not "silence".
Before printing the name of something audible while listening to a room:
say "[sound] from the "
A thing has some text called scent. The scent of a thing is usually "nothing".
The report smelling rule is not listed in the report smelling rulebook.
Carry out smelling something:
say "From [the noun] you smell [scent of the noun]."
Instead of smelling a room:
if a scented thing can be touched by the player, say "You smell [the list of scented things which can be touched by the player].";
otherwise say "The place is blissfully odorless."
Definition: a thing is scented if the scent of it is not "nothing".
Before printing the name of something scented while smelling a room: say "[scent] from the "
The Waning Moon Resort is a dark room. "A spacious room with a flagstone floor, and a dreamcatcher hung over the king-size bed." The dreamcatcher is scenery in the Resort. The description is "The usual web of threads and crystals, feathers and beads." Instead of taking the dreamcatcher, say "Ah, ah -- you might be tempted to take it as a souvenir, except that the price list in the minibar clearly states they charge $65 apiece if you walk off with one. Cheaper than stealing the Frette bathrobes, but still probably not a good idea."
The king-size bed is an enterable supporter in the Resort. The description is "200-thread-count Egyptian cotton sheets, according to the website. You would make fun, only they really are extraordinarily comfortable." The player is on the bed. A Lindt chocolate is on the bed. It is edible. The scent of the chocolate is "chocolate-hazelnut smell".
Instead of exiting: say "You are too weary to move."
The suitcase is an openable closed container in the Resort.
An electric light is a kind of device. Carry out switching on an electric light: now the noun is lit. Carry out switching off an electric light: now the noun is unlit. Understand "light" as an electric light.
The solar lamp is an electric light in Waning Moon Resort. The description is "Specially designed to give light in a spectrum resembling sunlight, to improve the mood and make a person energetic." The lamp is switched on and lit.
An electric noisemaker is a kind of device. An electric noisemaker has some text called usual sound. The usual sound of an electric noisemaker is usually "beepbeepbeep". Carry out switching on an electric noisemaker: now the sound of the noun is the usual sound of the noun. Report switching on an electric noisemaker: say "[The noun] goes [usual sound of the noun]!" instead. Report switching off an electric noisemaker: say "You switch off [the noun], silencing the [usual sound of the noun]." instead.
Carry out switching off an electric noisemaker: now the sound of the noun is "silence".
The bedside table is in the Resort. The table supports a potted plant and a Bose speaker. The scent of the potted plant is "rosemary"
The Bose speaker is an electric noisemaker. The usual sound of the speaker is "soothing whalesong". The sound of the speaker is "soothing whalesong". The speaker is switched on.
Instead of touching a device: say "You feel the surface of [the noun] and discover the switch."
Instead of touching a scented thing: say "The brush of your fingers stirs loose a fresh cloud of [scent of the noun] smell."
Rule for printing the description of a dark room: try listening; try smelling; rule succeeds.
Instead of examining an audible thing while in darkness: try listening to the noun. Instead of examining something while in darkness: try touching the noun.
Before touching something when in darkness:
say "You grope about..."
After inserting the plant into something:
say "You unceremoniously dump [the noun] into [the second noun], hoping it sustains no important damage thereby."
Before printing the name of a dark room: if the player can touch an audible thing, say "Noisy "; if the player can touch a scented thing, say "Perfumed ".
Visibility rule when in darkness:
if examining something, there is sufficient light;
there is insufficient light.
Rule for printing the announcement of darkness: say "It is now pleasantly lightless in here." instead.
Rule for deciding the scope of the player while in darkness: place the location in scope.
To decide whether in daylight:
if in darkness, no;
yes.
Instead of sleeping when in daylight:
say "You've never been able to sleep with the light on."
Instead of sleeping when the player can touch an audible thing (called the irritant):
say "The steady [sound of the irritant] from [the irritant] prevents your slumber."
Instead of sleeping when the player can touch a scented thing (called the irritant):
if the irritant is chocolate, say "The smell of chocolate continues to tantalize you, keeping you from sleep.";
otherwise say "You sniffle. [The irritant] is probably acting on your allergies."
Instead of sleeping:
say "You slip easily into the arms of Morpheus.";
end the story finally saying "At last..."
When play begins:
say "You have at last escaped from the airport and gotten through customs; survived an unnerving taxi ride over icy highways; stared down the impertinent concierge; endured the bellhop's catalog of features in your room; and achieved, finally, a moment of peace. Time for a good night's slumber!"
Test me with "x dreamcatcher / switch lamp off / look / sleep / eat chocolate / sleep / get plant / examine plant / open suitcase / put plant in suitcase / close suitcase / sleep / look / examine bose / switch bose off / sleep".
"Cloak of Darkness" is a brief example game that has been implemented in nearly every IF system currently used. It hasn't got much claim to complexity or richness, but it does exemplify many of the standard things one might want an IF language to be able to do: define descriptions and the results of actions, assign synonyms to nouns, create new verbs, handle darkness, track repeated acts, and so on.
Here is what the game looks like in Inform:
"Cloak of Darkness"
The story headline is "A basic IF demonstration."
Use scoring.
The maximum score is 2.
Whatever room we define first becomes the starting room of the game, in the absence of other instructions:
Foyer of the Opera House is a room. "You are standing in a spacious hall, splendidly decorated in red and gold, with glittering chandeliers overhead. The entrance from the street is to the north, and there are doorways south and west."
Instead of going north in the Foyer, say "You've only just arrived, and besides, the weather outside seems to be getting worse."
We can add more rooms by specifying their relation to the first room. Unless we say otherwise, the connection will automatically be bidirectional, so "The Cloakroom is west of the Foyer" will also mean "The Foyer is east of the Cloakroom":
The Cloakroom is west of the Foyer. "The walls of this small room were clearly once lined with hooks, though now only one remains. The exit is a door to the east."
In the Cloakroom is a supporter called the small brass hook. The hook is scenery. Understand "peg" as the hook.
Inform will automatically understand any words in the object definition ("small", "brass", and "hook", in this case), but we can add extra synonyms with this sort of Understand command.
The description of the hook is "It's just a small brass hook, [if something is on the hook]with [a list of things on the hook] hanging on it[otherwise]screwed to the wall[end if]."
This description is general enough that, if we were to add other hangable items to the game, they would automatically be described correctly as well.
The Bar is south of the Foyer. The printed name of the bar is "Foyer Bar". The Bar is dark. "The bar, much rougher than you'd have guessed after the opulence of the foyer to the north, is completely empty. There seems to be some sort of message scrawled in the sawdust on the floor."
The scrawled message is scenery in the Bar. Understand "floor" or "sawdust" as the message.
Neatness is a kind of value. The neatnesses are neat, scuffed, and trampled. The message has a neatness. The message is neat.
We could if we wished use a number to indicate how many times the player has stepped on the message, but Inform also makes it easy to add descriptive properties of this sort, so that the code remains readable even when the reader does not know what "the number of the message" might mean.
Instead of examining the message:
increment score;
say "The message, neatly marked in the sawdust, reads...";
end the story finally.
This second rule takes precedence over the first one whenever the message is trampled. Inform automatically applies whichever rule is most specific:
Instead of examining the trampled message:
say "The message has been carelessly trampled, making it difficult to read. You can just distinguish the words...";
end the story saying "You have lost".
This command advances the state of the message from neat to scuffed and from scuffed to trampled. We can define any kinds of value we like and advance or decrease them in this way:
Instead of doing something other than going in the bar when in darkness:
if the message is not trampled, now the neatness of the message is the neatness after the neatness of the message;
say "In the dark? You could easily disturb something."
Instead of going nowhere from the bar when in darkness:
now the message is trampled;
say "Blundering around in the dark isn't a good idea!"
This defines an object which is worn at the start of play. Because we have said the player is wearing the item, Inform infers that it is clothing and can be taken off and put on again at will.
The player wears a velvet cloak. The cloak can be hung or unhung. Understand "dark" or "black" or "satin" as the cloak. The description of the cloak is "A handsome cloak, of velvet trimmed with satin, and slightly splattered with raindrops. Its blackness is so deep that it almost seems to suck light from the room."
Carry out taking the cloak:
now the bar is dark.
Carry out putting the unhung cloak on something in the cloakroom:
now the cloak is hung;
increment score.
Carry out putting the cloak on something in the cloakroom:
now the bar is lit.
Carry out dropping the cloak in the cloakroom:
now the bar is lit.
Instead of dropping or putting the cloak on when the player is not in the cloakroom:
say "This isn't the best place to leave a smart cloak lying around."
When play begins:
say "[paragraph break]Hurrying through the rainswept November night, you're glad to see the bright lights of the Opera House. It's surprising that there aren't more people about but, hey, what do you expect in a cheap demo game...?"
Understand "hang [something preferably held] on [something]" as putting it on.
Test me with "s / n / w / inventory / hang cloak on hook / e / s / read message".
And that's all. As always, type TEST ME to watch the scenario play itself out.