By default, "TAKE OAK" in the example above will produce the response "That's hardly portable." This is fine under many circumstances, but also a bit generic, so we might want to override it for a specific game.
"Replanting"
The Orchard is a room. "Within this quadrille of pear trees, a single gnarled old oak remains as a memory of centuries past." The gnarled old oak tree is scenery in the Orchard.
Instead of taking some scenery: say "You lack the hulk-like strength."
Test me with "take oak".
Here we've used an "instead" rule; we will learn more about these in the section on actions. This allows us to define our own results for taking an object.
Note: "scenery" is a property of an object (about which we will hear more later). So when we use it in rules, we can talk about "some scenery", "something that is scenery", or even "a scenery thing" -- the last one doesn't sound much like English, but is a more plausible construction with other adjectives.
Suppose we want to make the player's life slightly easier by examining everything he picks up, if he hasn't already examined it.
"Morning After"
A thing can be examined or unexamined.
After taking something unexamined:
say "Taken. [run paragraph on]";
try examining the noun.
Carry out examining something:
now the noun is examined.
Carry out rules are explained in more detail in the chapter on advanced action handling. For now, it may be enough to know that what we put into this carry out rule for examining will happen any time anything is examined, but that it will not interfere with the rest of the predefined behavior of the action. The player will still see the object description and so on, as usual.
The Red Door Saloon is a room. "This old place is in pretty bad shape since the mine shut down. Now there's not much to see but the pair of deep gouges in the floorboards where they dragged away the Sheriff's corpse with the spurs still on."
Jed is a man in the Red Door Saloon. "At 8:30 AM the only person around is old Jed, collecting his hangover cure."
The pistol is a thing in the Red Door Saloon. The description of the pistol is "It ain't too accurate, but for two dollars you can't expect much."
The hangover cure is a thing in the Red Door Saloon. The description of the hangover cure is "Two yellow egg-yolks unbroken in a red-brown liquid. Yep."
Test me with "x pistol / get all".
Suppose that we want to change the reporting of "take" so that the player is always told something like "You take the book from the shelf." or "You pick up the toy from the ground." In order to generate these reports, we will need to know where the object started, even though by the time we are printing the output, the object will have moved.
"Removal"
The Pharmacy is a room. A desk and a trash can are in the Pharmacy. The pill-counter, a prescription, and a computer are on the desk. The computer is fixed in place. The pill-counter contains some Vicodin. The trash can contains an empty box.
The taking action has an object called previous locale (matched as "from").
The previous locale could in theory be either a thing or a room, so we make it "an object" -- that is, the most generic possible kind, to which both things and rooms belong. Now we record what the previous locale is at the beginning of each taking action:
Setting action variables for taking:
now previous locale is the holder of the noun.
Report taking something from the location:
say "You pick up [the noun] from the ground." instead.
Report taking something:
say "You take [the noun] from [the previous locale]." instead.
Test me with "get all".
By default, Inform only lets the player drop those things which he is carrying -- that is, those directly in his possession. Things inside satchels or on portable trays have to be taken first.
If we want to change this behavior, we might add a dropping rule that distinguishes between carrying and mere enclosure (introduced back in "The location of something" in the chapter on Things):
"Celadon"
The Tea Room is a room. The player carries a black lacquer tray. The lacquer tray is portable. On the lacquer tray are a celadon teapot and a napkin.
Before dropping something:
if the player does not carry the noun and the player encloses the noun:
say "(first taking [the noun] from [the holder of the noun])[command clarification break]";
silently try taking the noun;
if the player does not carry the noun, stop the action.
Instead of taking the napkin:
say "It seems to be stuck to the tray, possibly by an underlying wad of gum."
Test me with "i / drop teapot / i / look / drop teapot / drop napkin / i / drop tray".
"Stop" and "Continue" are most useful when we need to write rules that will have to stop the action some of the time but at other times let it pass; so for instance:
"Democratic Process"
Before inserting something which is not carried by the player into something:
if the noun is in the second noun, say "Already done." instead;
say "(first taking [the noun])[line break]";
silently try taking the noun;
if the player is not holding the noun, stop the action.
Before putting something which is not carried by the player on something:
if the noun is on the second noun, say "Already done." instead;
say "(first taking [the noun])[line break]";
silently try taking the noun;
if the player is not holding the noun, stop the action.
The Assembly Room is a room. "On most days, this room is used for elementary school assemblies; at the moment, it serves as a voting place." The ballot is on the desk. The desk is in the Assembly Room.
The machine is a container in the Assembly Room. "On the ballot machine is a sign which reads 'PUT BALLOTS IN ME :)'." Understand "ballot machine" as the machine.
Test me with "put ballot in machine".
Suppose that we have a design in which the player spends lots of time on enterable supporters, and in which we want to report certain actions -- dropping things onto those supporters, or leaping from one to another -- in a new way. We might begin by adding some action variables to help us keep track of the situation:
"Croft"
The dropping action has an object called the container dropped into (matched as "into").
The dropping action has an object called the supporter dropped onto (matched as "onto").
Rule for setting action variables for dropping:
if the actor is in a container (called C), now the container dropped into is C;
if the actor is on a supporter (called C), now the supporter dropped onto is C.
Report dropping a heavy thing onto a metallic thing:
say "You drop [the noun], and [the supporter dropped onto] clangs protestingly." instead.
Report someone dropping a heavy thing onto a metallic thing:
say "[The actor] drops [the noun] onto [the supporter dropped onto], which clangs protestingly." instead.
A thing can be heavy or light. A thing can be metallic or ordinary. A thing is usually ordinary. A thing is usually light.
The Ancient Cambodian Temple is a room. "A vast space built for ancient and forgotten rituals. The stone floor crawls with vermin. Well above the floor, and separated by some feet, are twin platforms built into the wall: the one carved of jointed wood, the other of sheets of graven bronze."
A platform is a kind of supporter. A platform is always enterable. A platform is usually scenery.
The bronze platform is a metallic platform in the Temple. Lara is a woman. She is on the bronze platform. She wears safari pants and a tank top. She carries a gun and a map. The gun is heavy.
The wood platform is an ordinary platform in the Temple. The player is on the wood platform. The player carries a rope, an Ancient Cambodian/English Phrasebook, a pickaxe, and a precious idol. The idol and the pickaxe are heavy.
Persuasion rule: persuasion succeeds.
The entering action has an object called the place left (matched as "from").
Check entering a platform from a platform:
if actor is the player, say "You leap into midair to cross the distance...";
otherwise say "[The actor] leaps gracefully across the distance...";
move the actor to the holder of the noun, without printing a room description.
Because this rule occurs before the "implicitly pass through other barriers rule", that rule will not occur when we move from platform to platform; we'll use our own custom rule instead.
Rule for setting action variables for entering:
now the place left is the holder of the actor.
Report entering a platform from a platform:
say "You land in a cat-like crouch on [the noun]." instead.
Report Lara entering a platform from a platform:
say "Lara lands soundlessly on [the noun][if the noun supports the player] beside you[end if]." instead.
Report entering a platform from the location:
say "You jump, catch the edge of [the noun] in your hands, and -- exerting considerable upper-body strength -- pull yourself up onto it." instead.
Report Lara entering a platform from a location:
say "Lara jumps, catches the edge of [the noun], and is standing upright on it, all in less time than it takes to tell."
Instead of examining a person who is not the player:
say "[The noun] carries [list of things carried by the noun] and wears [list of things worn by the noun]."
Instead of climbing a platform, try entering the noun.
Test me with "Lara, drop map / lara, drop gun / drop idol / enter bronze platform / drop pickaxe / get off / climb wood".
As mentioned in this section, the "implicitly taking" activity does not allow us to skip an implicit take entirely. In order to do this, we need to borrow from the chapter on Rulebooks and tell Inform that one of the rules normally built in to the Standard Rules does nothing in certain circumstances:
"Lollipop Guild"
The carrying requirements rule does nothing when showing something to the guardian.
The can't show what you haven't got rule does nothing when showing something to the guardian.
The block showing rule does nothing.
Candyland is a room. "A fizzing, popping wonderland of sugary delights. A path tiled with butterscotch sweets leads to the horizon."
The butterscotch path is scenery in Candyland.
The player carries a basket. In the basket are a licorice gumdrop and a can of tuna. The gumdrop is edible. The description of the gumdrop is "Covered all over with grains of sugar." The can of tuna is edible. The description of the can of tuna is "A rare import in this place."
The giant lollipop is a fixed in place edible thing in Candyland. "Growing right next to the path, on a trunk of white paper, is a giant lollipop colored green and red and white." The description of the lollipop is "If you were very blind, like Aunt Myrtle, you might mistake it for a young sapling just planted: the lollipop is just that leafy shade of green, with swirls of white and red that might be branches or flowers."
The guardian is a man in Candyland. "Right beside you is a guardian in a mint-colored uniform." The description of the guardian is "A killjoy wielding a gigantic toothbrush." The guardian carries a gigantic toothbrush. The description of the toothbrush is "Bristles as long as your hand. Firm bristles, too, not those soft ones. The guardian doesn't care about your tender gums."
A thing can be sweet. The butterscotch path, the lollipop, and the gumdrop are sweet.
Carry out showing a sweet thing to the guardian:
say "The guardian shrieks! You don't understand its language, but from its ululations you understand the idea of decay. There may have been a bit in there about a root canal." instead.
Carry out showing something to the guardian:
say "The guardian nods approvingly at the unsweetened [noun]." instead.
Report eating a sweet thing in the presence of the guardian:
say "The guardian looks mournful, but unholsters his tube of paste and begins applying it to the toothbrush, as though to say that he really did not want to have to do this...";
end the story saying "Everything goes minty" instead.
Report eating something:
say "You consume [the noun] with gusto." instead.
Test me with "x guardian / x toothbrush / show gumdrop to guardian / show path to guardian / show tuna to guardian / look / eat gumdrop".
Note that because we only deactivate the carrying requirements rule for showing purposes, the player still takes the gumdrop before eating it.
The above example does not quite work when we want the player to be allowed to take multiple objects at once before putting them somewhere: we also need to add a couple of "understand" rules borrowed from many chapters later. While the reasons may not be immediately clear, we include the demonstration here for the sake of thoroughness:
"Sand"
Before inserting something which is not carried by the player into something:
if the noun is in the second noun, say "Already done." instead;
say "(first taking [the noun]) ";
silently try taking the noun;
if the player is not holding the noun, stop the action.
Before putting something which is not carried by the player on something:
if the noun is on the second noun, say "Already done." instead;
say "(first taking [the noun])[line break]";
silently try taking the noun;
if the player is not holding the noun, stop the action.
Understand "put [things] in [something]" as inserting it into. Understand "put [things] on [something]" as putting it on.
The Closet is a room.
A lentil is a kind of thing. A black-eyed pea is a kind of thing. The closet contains 3 lentils. The Closet contains 14 black-eyed peas. The round tin is a container in the closet. The round tin contains 17 lentils. The square tin is a container in the Closet. The square tin contains 20 black-eyed peas.
Sorting is a scene. Sorting begins when play begins. Sorting ends when all the lentils are in the round tin and all the black-eyed peas are in the square tin. When Sorting ends, end the story finally.
When play begins: say "Thanks to your cruel stepmother, you're not going anywhere until the lentils and peas are sorted."
Test me with "put peas in square tin / put lentils in round tin".