# Relations using directions. (I7)[SOLVED]

How can you set up a relation similar to the one between rooms, but between objects within these rooms? Like being able to place a chair north of a desk?

Perhaps add a value to the object which tells you its location. Maybe even an X and Y within the room of objects within rooms and all of the objects placed in the rooms at the onset of the game would have those entered in.

A few things you might want to consider, depending on exactly what you want to use this for:
–If a person picks up the object, maybe the values should be cleared since they’re no longer in the room?
–If an object is in a container in a room, how should that be handled? Should they have the same X,Y or ones defining their place in the container?
–What if someone places an object in the container that didn’t start there?
–What if the container is carried by a person or in a container of its own, etc.?
–If a person drops an object in a room, what would its location be? Randomly chosen, one default location where objects heap up, etc?

Their values would be that of the player.

The same x, y.

Then the object’s values would imitate the container.

See above.

The location would be that of the player. What I mean is, the player can be in a corner and when the player drops something, it will be in the corner where he is.

What I mean though, Is a relation similar to the one you use to make maps, the “The foyer is north of the Drawbridge.” kind of thing.

Why reinvent the wheel?

I am trying to adapt the wheel to make a gear.

Inform currently doesn’t have direct support for three-way relations, and there are bugs involving relation-valued properties. Your best bet is probably a relation to relations, one for each direction:[code]Section “Setup”

Thing directionality relates one direction to one relation of things to things.
The verb to be submapped by implies the thing directionality relation.

Submapped north relates various things to one thing.
The verb to be submapped north of implies the submapped north relation.
The verb to be submapped north from implies the submapped north relation.
North is submapped by the submapped north relation.

Submapped northeast relates various things to one thing.
The verb to be submapped northeast of implies the submapped northeast relation.
The verb to be submapped northeast from implies the submapped northeast relation.
Northeast is submapped by the submapped northeast relation.

Submapped northwest relates various things to one thing.
The verb to be submapped northwest of implies the submapped northwest relation.
The verb to be submapped northwest from implies the submapped northwest relation.
Northwest is submapped by the submapped northwest relation.

Submapped south relates various things to one thing.
The verb to be submapped south of implies the submapped south relation.
The verb to be submapped south from implies the submapped south relation.
South is submapped by the submapped south relation.

Submapped southeast relates various things to one thing.
The verb to be submapped southeast of implies the submapped southeast relation.
The verb to be submapped southeast from implies the submapped southeast relation.
Southeast is submapped by the submapped southeast relation.

Submapped southwest relates various things to one thing.
The verb to be submapped southwest of implies the submapped southwest relation.
The verb to be submapped southwest from implies the submapped southwest relation.
Southwest is submapped by the submapped southwest relation.

Submapped east relates various things to one thing.
The verb to be submapped east of implies the submapped east relation.
The verb to be submapped east from implies the submapped east relation.
East is submapped by the submapped east relation.

Submapped west relates various things to one thing.
The verb to be submapped west of implies the submapped west relation.
The verb to be submapped west from implies the submapped west relation.
West is submapped by the submapped west relation.

Submapped up relates various things to one thing.
The verb to be submapped up from implies the submapped up relation.
The verb to be submapped above implies the submapped up relation.
The verb to be submapped over implies the submapped up relation.
Up is submapped by the submapped up relation.

Submapped down relates various things to one thing.
The verb to be submapped down from implies the submapped down relation.
The verb to be submapped below implies the submapped up relation.
The verb to be submapped under implies the submapped up relation.
Down is submapped by the submapped down relation.

Submapped inside relates various things to one thing.
The verb to be submapped inside of implies the submapped inside relation.
The verb to be submapped inside from implies the submapped inside relation.
The verb to be submapped in from implies the submapped inside relation.
The verb to be submapped inside implies the submapped inside relation. [Must be listed last.]
The verb to be submapped in implies the submapped inside relation. [Must be listed last.]
Inside is submapped by the submapped inside relation.

Submapped outside relates various things to one thing.
The verb to be submapped outside of implies the submapped outside relation.
The verb to be submapped outside from implies the submapped outside relation.
The verb to be submapped out of implies the submapped outside relation.
The verb to be submapped out from implies the submapped outside relation.
The verb to be submapped outside implies the submapped outside relation. [Must be listed last.]
Outside is submapped by the submapped outside relation.

To decide what object is the thing (D - a direction) of/from (T - a thing):
let the submapping relation be the relation of things that D relates to by the thing directionality relation;
decide on the thing that T relates to by the submapping relation.
To decide what object is the thing above/over (T - a thing):
decide on the thing up from T.
To decide what object is the thing below/under (T - a thing):
decide on the thing down from T.
To decide what object is the thing in from (T - a thing):
decide on the thing inside from T.
To decide what object is the thing out of/from (T - a thing):
decide on the thing outside from T.

Section “Demo”

SHRDLU is a room.
A block, a cone, and a ball are here.
The block is submapped north of the cone; the cone is submapped south from the block.
The ball is submapped inside of the block; the block is submapped outside the ball.
When play begins:
showme the thing south of the block;
showme the thing inside from the thing north from the cone;
showme the thing east from the cone.[/code]

Seems wordy, but it should work.