# Prepositions and parsing

S001GMU at nova.wright.edu S001GMU at nova.wright.edu
Wed May 7 09:40:36 New Zealand Standard Time 1997

```Date: Tue, 06 May 1997 20:45:19 +0000 (PST8PDT)
From: clawrenc at cup.hp.com
Subject: [MUD-Dev]  Prepositions and parsing

>What with the recent discussion of parsers and methods of parsing
>commands, and old entry from my to-do list popped up:
>
>  Support for prepositions such as "under", "on top of", "behind" etc.
>
>Anyone got any ideas for supporting/parsing a command like:
>
>  hide under the desk
>
>or
>
>  put the rock under the rug behind the pillar

'On top of' and 'under' are pretty easy to handle.

What does 'Behind the pillar' mean?  Is behind relative to the room or to the
player?  The former is easy, the later not so easy, but much more realistic.
If you wanted it to be relative to the player you would have to know where the
player was relative to the object.   'Spose you could also have it be
relative to the object in question... a TV has a definite front and back...
when you are interested in watching it.  If it's just collecting dust in
the attic, though, then I don't spose it'd make a difference what direction
it was facing.. :)

You could have each object type have the possibility of a defined orientation.
The parser could then look for that first, and failing that, go by the
character's position.

Once you have the orientation of the object in question, you could then just
have some algorithm that determines what parts of the room's coordinate space
belong to what preposition.  An easy alg I can think of would be to treat
the object as a rectangular solid with each face of the solid determining the
near boundry of the coordinate space belonging to a given preposition (wouldn't
work too well with oddly shaped objects, though).  The far boundry could be
determined based on the size of the object in question... beside a building
and beside an apple are two entirely different things.

-Greg

```