Newsgroups: rec.arts.int-fiction
Path: nntp.gmd.de!Dortmund.Germany.EU.net!Germany.EU.net!howland.reston.ans.net!spool.mu.edu!news.cs.indiana.edu!shulick@strawberry.ucs.indiana.edu
From: "Sam Hulick" <shulick@strawberry.ucs.indiana.edu>
Subject: Re: Inform's "Listen" verb
Message-ID: <1995Oct5.134204.22897@news.cs.indiana.edu>
Organization: Vallen Software
References: <66.2844.1727@tabb.com>
Date: Thu, 5 Oct 1995 13:41:54 -0500
Lines: 61

joe.mason@tabb.com (Joe Mason) writes:
>I have a slight problem with Inform.  I'm using WinZip 1.1 under Windows
>'95 to interpret it.  My problem is that I have a room which contains
>the object "wind".  I'm trying to use the following code:
>
>Object  Winding_Stair "Winding Stair"
> with   description "This stairway snakes back and forth between sheer \
>          walls of rock, climbing ever higher towards the mountain \
>          peaks. The steps are worn and uneven beneath your feet, \
>          forcing you to pick your way carefully.  The footing is made \
>          even worse by slippery patches of moss growing in odd places \
>          on the stairway.",
>        before [;
>          Climb: <<go u_to>>;
>          Listen: <<listen wind>>;
>        ],
>        e_to Narrow_Cleft, d_to Narrow_Cleft,
>        sw_to Windswept_Plateau, u_to Windswept_Plateau,
> has    light;

Your problem is quite simple.  Recall that a before() on a ROOM will
block out that action entirely.  So what happens is, you type "listen".
The before() on the room catches that, and says.. Ok.. we'll
type <<Listen wind>> instead.  So that executes "listen window".  The
before() is run again, and says "Ok, we'll type <<Listen
wind>.'.. etc. etc.  You're looping infinitely.  Here is the fix:

Object  Winding_Stair "Winding Stair"
 with   description "This stairway snakes back and forth between sheer \
          walls of rock, climbing ever higher towards the mountain \
          peaks. The steps are worn and uneven beneath your feet, \
          forcing you to pick your way carefully.  The footing is made \
          even worse by slippery patches of moss growing in odd places \
          on the stairway.",
        before [;
          Climb: <<go u_to>>;
          Listen: if (noun == 0)
                  { print_paddr wind.description; new_line; rtrue; }
        ],
        e_to Narrow_Cleft, d_to Narrow_Cleft,
        sw_to Windswept_Plateau, u_to Windswept_Plateau,
 has    light;

Notice that you must check if the noun is empty.  If you don't check,
then even if they type "listen to magic box", then the 'listen' in this
room will catch it and print the description for the wind.  The wind
desc. will only be printed if we type 'listen' with no noun.

The basic thing to remember is, an action in a before on a ROOM will
block it 100% of the time, no matter what the noun is (unless the noun
is invalid), or even if there is no noun.  Just because you're calling
<<Listen wind>> doesn't make the rules any different... so of course
it's going to loop infinitely.

Hope this answers your question sufficiently.

-- 
--- Sam Hulick ------------- shulick@indiana.edu ---------------------
Systems Consultant        | Homepage:
Indiana College Placement |    http://copper.ucs.indiana.edu/~shulick/
  and Assessment Center   | PGP public key available on request
