Modern Conveniences by Emily Short Search for other extensions by this author Approved for the Public Library

Versions

Download version 5/150410For Inform 7 6L38

Links

Description

Modern Conveniences creates kitchen and bathroom kinds of room, which will automatically be furnished with a set of plausible appliances. (This was originally an example in the manual of how to create extensions, and an annotated version may still be found there.) Version 3 adds compatibility with Measured Liquid, modeling flowing water from taps.

Tags world-model

Documentation

Modern Conveniences provides a kitchen kind and a bathroom kind of room. Kitchens will automatically be furnished with scenery cabinets, counters (called "furniture counter" to distinguish them from other counter variables), stove-and-oven assemblies, sinks, and refrigerators. Bathrooms will automatically be furnished with sinks, toilets, baths, and cabinets. One slight challenge lies in giving these assembled pieces separate descriptions. When we have an assembly that adds parts to objects, we can then talk about (for instance) "the stove's switch" elsewhere in the code. But items that have been assigned rooms are not named in the same way, so we cannot talk about "the Industrial Kitchen's stove" in our code as a way to assign it a description or special behavior. If we only have one instance of each item in our game, we may simply say something like The description of a stove is "Scrupulously polished." applying the description to the class as a whole since there will only be one instance of it. In a game that features multiple bathrooms and kitchens, this won't be enough; we might instead give the items descriptions that check their location (if there are only a couple of each): The description of a stove is "[if in Industrial Kitchen]A massive stainless steel stove-top with six burners[otherwise]Your standard four-burner item[end if]." or create an Instead of examining the stove in the Industrial Kitchen: ... sort of rule for those objects we want to describe specially; or, as the most extreme case, we might write a When play begins: ... rule to initialize the features of the generated objects, like so: When play begins: let N be a random stove in the Industrial Kitchen; move the boiling pot to N; change the description of N to... We can also, of course, use the appliances individually. In the end, the "kitchen" and "bathroom" room types are likely to be most useful when we want to include the standard props but not actually make them a critical part of the game; if stoves and sinks have more of a starring role in the production, we may be better off coding them or at the very least placing them by hand, as in The Industrial Kitchen is a room. Thor is a stove in the Industrial Kitchen. It supports a boiling pot. Additional code is provided for a more rigorous treatment of liquids when this extension is used alongside Measured Liquid by Emily Short. In that case, turning on taps will create a liquid source called "flowing water" from which fluid containers can be filled. Example: * Our House - A minimalist house consisting of two rooms. *: "Our House" Include Modern Conveniences by Emily Short. Our Household Kitchen is a kitchen. The Tiny Bathroom is a bathroom. It is west of Our Household Kitchen. The description of a stove is "Scrupulously polished." The description of a refrigerator is "It is baby blue and has the contours of a 50[']s chevy. One of these days it really will break down, but it's been serving your family faithfully since your grandmother's honeymoon." Test me with "x refrigerator / open fridge / x freezer / look in freezer / open freezer / turn on stove / turn on oven / x oven switch / turn off oven switch / turn off stove switch / turn on taps / x sink / w / x sink / turn on sink / take bath / use toilet". Example: ** Getting a drink - A house in which we're allowed to turn on the taps and get a drink of the running water, using a cup we find in the kitchen cabinet. *: "Getting a Drink" Include Measured Liquid by Emily Short. Include Modern Conveniences by Emily Short. The Home Kitchen is a kitchen. The Little Bathroom is a bathroom. It is west of the Home Kitchen. The cup is a fluid container. It is preferred for drinking. When play begins: let target be a random cabinet in the Home Kitchen; move the cup to the target. Test me with "open cabinet / get cup / fill cup / turn on tap / fill cup / x cup / drink water / x cup / empty cup into sink / put cup in sink / turn off tap / x water / get cup / west / turn on water / fill cup / e / drink water / fill cup / turn on tap / fill cup / drink water / w / fill cup / empty cup in sink / e / put cup on counter / look". Example: ** Tidy Bowl - Adding a toilet bowl to every toilet, which will contain undrinkable toilet water. *: "Tidy Bowl" Include Measured Liquid by Emily Short. Include Modern Conveniences by Emily Short. The Home Kitchen is a kitchen. The Little Bathroom is a bathroom. It is west of the Home Kitchen. The cup is a fluid container. It is preferred for drinking. When play begins: let target be a random cabinet in the Home Kitchen; move the cup to the target. A toilet bowl is a kind of fluid container. A toilet bowl is part of every toilet. The liquid of a toilet bowl is toilet water. The fluid content of a toilet bowl is 163.0 fl oz. The fluid capacity of a toilet bowl is 163.0 fl oz. Setting action variables for pouring a toilet into something: now the noun is a random toilet bowl which is part of the noun. Setting action variables for filling something with a toilet: now the second noun is a random toilet bowl which is part of the second noun. Setting action variables for filling a toilet with something: now the noun is a random toilet bowl which is part of the noun. Setting action variables for pouring something into a toilet: now the second noun is a random toilet bowl which is part of the second noun. Setting action variables for drinking a toilet: now the noun is a random toilet bowl which is part of the noun. Rule for clarifying the parser's choice of a toilet: do nothing. Rule for clarifying the parser's choice of a toilet bowl: do nothing. Table of Liquids (continued) liquid potable flavor toilet water false -- Test me with "open cabinet / get cup / w / fill cup from toilet / x toilet bowl / pour cup into toilet / drink from toilet / fill cup with toilet water / empty toilet water into bath".