IQ Test
Example 189
★We have already seen how Before… rules can generate implicit actions for the player, so that the player will, for instance, open doors before trying to walk through them. The same can be done for characters other than the player; so for instance:
"IQ Test"
The Donut Shop is a room. "Vibrantly decorated in donut colors: pink, brown, and cream."
Ogg is a man in the Donut Shop. "Ogg is slumped in the corner[if Ogg carries something] with [a list of things carried by Ogg][end if]. He wears a nametag which says 'HELLO MY NAME IS OG.'" Understand "og" as Ogg. Ogg wears a nametag. The description of the nametag is "Sadly misspelled."
The Donut Shop contains a transparent closed openable locked lockable container called a case. The case contains some cake donuts. The donuts are edible.
The matching key of the case is a silver key. The silver key is carried by Ogg.
A persuasion rule for asking someone to try doing something:
persuasion succeeds.
Before someone opening a locked thing (called the sealed chest):
if the person asked is carrying the matching key of the sealed chest, try the person asked unlocking the sealed chest with the matching key of the sealed chest;
if the sealed chest is locked, stop the action.
Before someone taking something which is in a closed container (called the shut chest):
try the person asked opening the shut chest;
if the shut chest is closed, stop the action.
The block giving rule is not listed in the check giving it to rules.
Test me with "open case / get donuts / og, get donuts / og, give me the donuts / eat donuts".
Test me with "open case / get donuts / og, get donuts / og, give me the donuts / eat donuts".
Donut Shop
Vibrantly decorated in donut colors: pink, brown, and cream.
Ogg is slumped in the corner with a silver key. He wears a nametag which says "HELLO MY NAME IS OG."
You can also see a case (closed) (in which are some cake donuts) here.
>(Testing.)
>[1] open case
It seems to be locked.
>[2] get donuts
The case isn't open.
>[3] og, get donuts
Ogg unlocks the case.
Ogg opens the case.
Ogg picks up the cake donuts.
>[4] og, give me the donuts
Ogg gives the cake donuts to you.
>[5] eat donuts
You eat the cake donuts. Not bad.
Vibrantly decorated in donut colors: pink, brown, and cream.
Ogg is slumped in the corner with a silver key. He wears a nametag which says "HELLO MY NAME IS OG."
You can also see a case (closed) (in which are some cake donuts) here.
>(Testing.)
>[1] open case
It seems to be locked.
>[2] get donuts
The case isn't open.
>[3] og, get donuts
Ogg unlocks the case.
Ogg opens the case.
Ogg picks up the cake donuts.
>[4] og, give me the donuts
Ogg gives the cake donuts to you.
>[5] eat donuts
You eat the cake donuts. Not bad.
(A more detailed set of before rules for people using doors and locks is provided in Emily Short's Locksmith extension.)