Good. Then I’ll begin.
Having sucessfully created a way of allowing the player to “insert x” without having to specify into what x should be inserted, I thought I would try to do something similar if the player types “sit” and there is only one chair in the location.
This was not as easy as the “insert x” example. Understand “sit” as sitting does not work. A quick look at the actions index showed me why. Sit is used as a synonym for the entering action. Although I could have understand “sit” as entering, it seemed to me that this was starting to strain the English language.
I therefore decided to create a new action for sitting. To being with, I needed to break the link between sitting and entering and create a new action for sitting.
Understand the command “sit” as something new.
Sitting is an action with past participle sat, applying to one touchable thing.
Understand “sit on top of [something] as sitting.
Understand “sit on/in/inside [something] as sitting.
Understand “sit” as sitting.
This creates the framework for the new sitting action.
Next I needed to provide a rule for supplying a missing noun so that the command “sit” on its own would work.
Rule for supplying a missing noun when sitting (this is the find something to sit on rule):
let count be the number of enterable supporters in the location;
if count is 0:
say “There is nothing here to sit on.” instead;
if count is greater than 1:
say “You will need to specify what you want to sit on.” instead;
if count is 1:
let target be a random enterable supporter in the location;
change the noun to the target;
say “(on [the target])”.
This creates the correct framework but as yet, the sitting action does not do anything. To create a meaningful action I needed to add “check”, “carry out” and “report” rules to govern the action. To do this, I used the pattern of the “check”, “carry out” and “report” rules for the entering action.
Check an actor sitting (this is the can’t sit on something twice rule):
if the actor is on the noun:
if the actor is the player:
say “You are already sitting on [the noun].” instead;
otherwise:
say “[The actor] is already sitting on [the noun].” instead.
Check an actor sitting (this is the sit on non-supporters rule):
if the noun is not an enterable supporter:
say “It isn’t possible to sit on [the noun].” instead.
Check an actor sitting (this is the can’t sit on something carried rule):
if the holder of the noun is a person:
say “It isn’t possible to sit on [the noun] whilst it is being carried.” instead.
Carry out an actor sitting (this is the standard sitting rule):
surreptitiously move the actor to the noun.
Report an actor sitting (this is the standard report sitting rule):
if the actor is the player:
say “You sit on [the noun].”;
otherwise:
say “[The actor] sits on [the noun].”
And voila, a new action to allow the player to sit on things with a simple “sit” command allowing a short-cut where there is only one chair in the room.