Expanded Understanding by Xavid


This extension makes various tweaks to understand additional variations of commands and have cleverer, more specific error messages in common failure cases.

It requires and includes the related Small Kindnesses by Aaron Reed. It depends on Snippetage by Dave Robinson and Object Matching by Xavid for implementation details.

Some enhancements are specific to use with Approaches by Emily Short (including one to improve interaction with Simple Followers by Emily Short).

Part 1 - Command Tweaks

Chapter 1 - Aliases

This extension provides aliases to make commands the player might type work.

The command "remove" can mean taking something in a container (in addition to taking off something you're wearing).

"Set fire to" means to burn.

"Leave [room]" means to go outside, whether or not you actually can; you'll get the same error message as if you typed "outside".

Chapter 2 - Remapped Commands

We interpret "search" as examining a thing or room, on the assumption that this will show something's contents and is more likely to be correctly modified for things with special description rules.

Chapter 3 - Modified Commands

Section 1 - Examining Tweaks

This raises the priority of things when examining so that, in the common case where there's a scenery thing in a room with a similar name, the thing wins. (Examining rooms is enabled by the required Small Kindnesses by Aaron Reed.)

You can set this for individual things by saying:

The river is visible from a distance.

To change the default for, say, scenery:

A scenery thing is usually visible from a distance.

Section 2 - Entering

The Standard Rules defines an enter variation with no object. We get rid of this so that you get the parenthetical message about what you're entering when entering something without specifying it specifically.

Part 2 - Cleverer Error Messages

This extension attempts to improve some error messages in a few common cases when players refer to nouns that aren't available.

Chapter 1 - Examining

If the player tries to examine something that's not here but they've seen before, this extension reminds them where they last saw it. (This functionality is inspired by Remembering by Aaron Reed but is implemented differently to avoid modifying the understanding of commands that aren't errors.)

To make natural messages about things being in rooms, we give rooms a property called the "at preposition". This is "at" by default for messages like "You last saw it at the river." but can be set to, say, "in" for indoor rooms. In addition, you can have rooms be improper-named for these messages to use lower case and the article "the".

In addition, the error messages are reworked to use the specific words typed by the player in some cases.

Chapter 2 - Taking and Dropping

We similarly use remembering and specific words for error messages from taking and dropping action.

Chapter 3 - All

Section 1 - General

We have more specific error messages for commands with all where nothing matches (e.g., take all when there's nothing here or drop all when you're not holding anything) to replace the default "There are none at all available!" The new messages are specifically based on the action the player was trying to take.

Section 2 - Drop All

By default, the standard rules provide several variations of drop that allow multiple things; in addition to the basic "drop all", you can also do "drop all into box" or "drop all onto table". The problem is that if you do "drop all" when you aren't holding anything, you get a clarification message appropriate to one of those unusual variations like "What do you want to drop those things in?", which is confusing. To avoid this, we disable clarification for dropping all when the actor isn't holding anything.

Section 3 - Limiting All

Inform uses "whether all includes" rules to, e.g., include scenery from "take all". Unfortunately, as defined in the Standard Rules these rules apply just to the player, not other actors. We provide versions of the same rules for any actor.

Part 3 - Conversation

We add several variations of "tell someone to do something" as an alternative to "someone, do something". We also understand a command that starts with someone's name as an order even if the comma is left off (if the name is one word long).

We add "tell someone that something" as an alternative to "answer".

We also understand "remind someone that something" as "someone, remember something". Remember isn't actually understood by default, but you can either make it a command or handle this with "answer someone that" -based rules.

Part 4 - Improvements with Approaches by Emily Short

We allow the player to go to a visited room by going to the name of a fixed in place or scenery thing in that room, using it as a landmark, instead of just the room name.

We display the direction traveled even when going to an adjacent room to be more explicit.

We improve error messages to use the "at preposition" property described above.

We also improve its compatibility with Simple Followers (also by Emily Short), so you don't leave people behind when to travel long distances with "go to".

Part 5 - Improvements with Implicit Actions by Eric Eve

We allow NPCs to implicitly take things, which is normally allowed by the Standard Rules but is disabled with the Implicit Actions extension (which is otherwise great because it improves error messages when you try to implicitly take something but can't).

In addition, we fix an extra line break that normally shows up after the failure-to-take message when you try and fail to implicitly take something.

Part 6 - Bugs and Comments

This extension is hosted in Github at https://github.com/i7/extensions/tree/master/Xavid. Feel free to email me at extensions@xavid.us with questions, comments, bug reports, suggestions, or improvements.

Example: * Shed - Improved errors.

"Shed"

Include Expanded Understanding by Xavid.

Shed is a room.

A supporter called a table is here.

A thing called a hammer is here.

South of Shed is Yard.

A scenery thing called the sunset is here.

A fixed in place thing called the stump is here.

Test me with "drop all / take hammer / s / take all / x table".

Example: ** Unit Tests

"Unit Tests"

Include Expanded Understanding by Xavid.
Include Command Unit Testing by Xavid.
Include Approaches by Emily Short.
Include Implicit Actions by Eric Eve.

Shed is an improper-named room. The at preposition is "in".

A scenery thing called a glowing orb is here.

A supporter called a table is here. On the table is a saw.

A thing called a hammer is here.

A vehicle called a hovercraft is here.

A container called a box is here.
A thing called an apple is in the box.
A thing called a pear is in the box.

A room called In Yard is south of Shed.
Inside from In Yard is Shed.

A scenery thing called the yard is here. "This is a thing, not a room."

A fixed in place thing called the stump is here.

A woman called the girl is here.
Persuasion rule for asking someone to try doing something:
     persuasion succeeds.
The block giving rule does nothing.

An animal called the penguin is here.

Filling it from is an action applying to two things.
Understand "fill [something] from [something]" as filling it from.

Understand "put out [something] with [something preferably held]" as putting it on (with nouns reversed).

Understand "put [something preferably held] in front of [something]" as putting it on.

Zapping is an action applying to one thing.
Understand "zap [something]" as zapping.
Instead of zapping something:
     say "Zot!";
     now the noun is nowhere.

A room called Roof is up from Shed.

Unit test:
     start test "x here";
     assert that "x room" produces "Shed[line break]You can see a table (on which is a saw), a hammer, a hovercraft (empty) and a box (in which are an apple and a pear) here.";
     start test "implied preposition grammar";
     assert that "fill stump girl" produces "You don't see any stump girl here.";
     start test "all";
     assert that "drop all" produces "You're not carrying anything to drop.";
     do "take hammer";
     do "s";
     assert that "take all" produces "You don't see anything obvious to take.";
     start test "remembered examining";
     assert that "x table" produces "You don't see the table here. It was in the shed.";
     start test "scenery matches room";
     assert that "x yard" produces "This is a thing, not a room.";
     start test "examining errors";
     assert that "x wombat" produces "You don't see any wombat here.";
     assert that "Examine wombat." produces "You don't see any wombat here.";
     assert that "x orb table" produces "You don't see any orb table here.";
     start test "alternate ways of ordering";
     assert that "girl jump" produces "The girl jumps on the spot.";
     assert that "order girl to jump" produces "The girl jumps on the spot.";
     assert that "girl" produces "That's not a verb I recognise.";
     assert that "girl," produces "There is no reply.";
     start test "failing to implicitly take";
     assert that "put stump on yard" produces "(first trying to take the stump)[line break]That's fixed in place.";
     start test "going to";
     assert that "go to orb" produces "You go inside to the shed. [paragraph break]Shed[line break]You can see a table (on which is a saw), a hovercraft (empty) and a box (in which are an apple and a pear) here.";
     start test "complex taking";
     assert that "take hammer from table" produces "The hammer isn't on the table. It's among your possessions.";
     assert that "take hammer from stump" produces "You don't see the stump here. It was at In Yard.";
     assert that "take stump yard from table" produces "You don't see any stump yard on the table.";
     start test "take off";
     assert that "take off stump" produces "You're not wearing any stump.";
     assert that "take stump off" produces "You're not wearing any stump.";
     start test "drop";
     assert that "drop stump" produces "You don't have the stump in your possession. It was at In Yard.";
     assert that "drop stump on table" produces "You don't have the stump in your possession. It was at In Yard.";
     assert that "drop stump on counter" produces "You don't have the stump in your possession. It was at In Yard.";
     assert that "drop rock and hammer" produces "You don't have any rock in your possession.";
     assert that "drop hammer and rock" produces "You don't have any rock in your possession.";
     assert that "drop rock, hammer" produces "You don't have any rock in your possession.";
     assert that "drop hammer, rock" produces "You don't have any rock in your possession.";
     assert that "drop hammer on counter" produces "You don't see any counter here.";
     assert that "drop onto table" produces "I'm not sure what you want to drop.";
     start test "put";
     assert that "put stump on table" produces "You don't have the stump in your possession. It was at In Yard.";
     start test "give";
     do "take saw";
     do "s";
     assert that "give all to girl" produces "saw: You give the saw to the girl.[line break]hammer: You give the hammer to the girl.";
     assert that "girl, give all to me" produces "hammer: The girl gives the hammer to you.[paragraph break]saw: The girl gives the saw to you.";
     assert that "give girl all" produces "saw: You give the saw to the girl.[line break]hammer: You give the hammer to the girl.";
     assert that "girl, give me all" produces "hammer: The girl gives the hammer to you.[paragraph break]saw: The girl gives the saw to you.";
     assert that "take all from girl" produces "You don't see anything obvious to take.";
     assert that "give hammer girl" produces "You give the hammer to the girl.";
     do "n";
     assert that "give saw to girl" produces "You don't see the girl here. You last saw her at In Yard.";
     assert that "give saw to table" produces "You can only do that to something animate.";
     assert that "use saw on table" produces "You'll have to try a more specific verb than use.";
     start test "complex verb lines";
     do "drop saw";
     assert that "put out stump with saw" produces "You don't see the stump here. It was at In Yard.";
     do "s";
     assert that "put out stump with saw" produces "You don't have the saw in your possession. You dropped it in the shed.";
     start test "multiword verb messages";
     assert that "put out fish with saw" produces "You don't see any fish here.";
     assert that "put out fish" produces "You don't see any fish here.";
     start test "items that aren't where you remember them";
     assert that "take saw" produces "You don't see the saw here. You dropped it in the shed.";
     do "n";
     do "zap saw";
     assert that "take saw" produces "You don't see the saw here.";
     do "s";
     assert that "take saw" produces "You don't see the saw here.";
     start test "held by";
     assert that "take stump from girl" produces "The stump isn't held by the girl. It's right here.";
     start test "enter";
     do "enter";
     assert that "[location]" substitutes to "Shed";
     assert that "enter" produces "(the hovercraft)[line break]You get into the hovercraft.";
     start test "empty";
     assert that "empty box onto table" produces "(first taking the box)[line break]You put the pear and the apple from the box onto the table.";
     assert that "empty table onto box" produces "You put the pear and the apple from the table into the box.";
     assert that "empty box into box" produces "You can't empty something into itself!";
     assert that "empty box into me" produces "You can't empty something into a person!";
     assert that "empty box" produces "You put the pear and the apple from the box into the hovercraft.";
     do "put apple on table";
     do "exit hovercraft";
     assert that "empty table" produces "You remove the apple from the table and put it down.";
     do "put apple in hovercraft";
     assert that "empty hovercraft" produces "You remove the apple and the pear from the hovercraft and put them down.";
     start test "periods";
     assert that "take pie. jump" produces "You don't see any pie here.";
     assert that "take. jump" produces "I'm not sure what you want to take.";
     start test "give nonsense";
     do "s";
     assert that "give girl symbol" produces "You don't have any symbol in your possession.";

Test me with "unit".

Example: *** Unit Tests with Unknown Word Error by Mike Ciul

"Unit Tests with Unknown Word Error by Mike Ciul"

Include Expanded Understanding by Xavid.
Include Command Unit Testing by Xavid.
Include Unknown Word Error by Mike Ciul.

Shed is an improper-named room. The at preposition is "in".

A scenery thing called a glowing orb is here. It is visible from a distance.

A supporter called a table is here. On the table is a saw.

Unit test:
     start test "examining errors";
     assert that "x wombat" produces "I don't know the word 'wombat'.";
     assert that "x orb table" produces "You don't see any orb table here.";

Test me with "unit".