The player is standing in front of a slot machine and types the command “insert coin”.  The games responds with “what do you want to insert the coin into” (or words to that effect).

I had a similar situation in my code.  Looking the the Inform 7 manual, it looked like I needed to add some code using the “rule for supplying a missing second noun when inserting”.  I duly added the rule and lo and behold it did not work.  Fiddlesticks, I said, or words to that effect.  Much head scratching later, it transpires that not only did I need to add the “missing second noun” rule, I also need to create a new “understand” token.

The new code now allows the player to short cut inserting items into things by simply typing “Insert thing”.

<code>

Understand “Insert [something]” as inserting it into.

Rule for supplying a missing second noun when inserting:

let count be the number of open containers in the location;

If count is 0:

say “There is nothing to insert [the noun] into here.” instead;

if count is 1:

change the second noun to a random open container in the location;

if count is greater than 1:

say “You will need to specify what you want to insert [the noun] into.” instead.

 </code>

 

Advertisement