Teleportation by region?

In another thread, matt w posted a response for teleportation:

Teleporting is an action applying to one visible thing. Understand "go to [any room]" as teleporting. Carry out teleporting: move the player to the noun.

Is there a way to limit the teleportation by region and visitation? Like say, the map is a two-story house, and you want the player to only be able to teleport to the rooms of the floor that he’s on? Also, is there way to do it so that the player can only teleport to the room after it’s been visited?

thanks!

Yes, a “check teleporting” rule should serve in each case.

“Visited” and “unvisited” already are meaningful adjectives for rooms per the Standard Rules. “Check teleporting when the noun is an unvisited room…”

You’ll need to set up your regions as appropriate. It might also be helpful to set up a “to decide” phrase along the lines of “To decide which region is the teleportable zone…” so you can make a rule like “Check teleporting when the noun is not in teleportable zone…”

Okay, so here is what I have so far:

[code]
Teleporting is an action applying to one visible thing. Understand "go to [any room] as teleporting.

Check teleporting:
if the noun is an unvisited room:
say “How do you even know where that is?”;
stop the action;
if the player is in the location of the noun:
say “You are already here.”;
stop the action;
if the noun is not in the region of the player;
say “You’d need some nearby stairs to get there first.”;
stop the action.

Carry out teleporting:
now the player is in the location of the noun.

Master is a room.

Guest Room is south of Master.

Guest Bath is east of Guest Room.

Second Floor Stairs is south of Guest Room.

Second Floor is a region. Master, Guest Room, and Guest Bath are in Second Floor.

Kitchen is a room.

Dining is south of Kitchen.

Living is east of Dining.

First floor stairs is south of Dining and down of Second Floor Stairs.

First Floor is a region. Kitchen, Dining, Living, and Second Floor Stairs are in First Floor.[/code]

I was able to get the first two checks to work properly. The third check is what I’m having trouble with, particularly the proper phrasing to use. I put it in bold so that you can hopefully see what it is I’m trying to achieve. I want the player to be able to teleport to any room on the second floor when he is on the second floor (but not be able to teleport to any room on the first floor), and for the equivalent condition to work when he is on the first floor.

You’re pretty close. I’m not sure what it’s like in 6M62, but in 6L38 there’s not good support for the phrase you’re trying to use. This is because there’s no verb covering the relation linking rooms and regions in the direction you want. (See below.)

In other words, "region of " doesn’t normally have any meaning to the compiler. You can give it the meaning in a pretty straightforward way, though:

[code]The verb to regionally-include means the regional-containment relation.

To decide which region is the region of (X - a room):
decide on a random region that regionally-includes X.

Check teleporting:
if the noun is an unvisited room:
say “How do you even know where that is?”;
stop the action;
if the player is in the location of the noun:
say “You are already here.”;
stop the action;
if the region of the noun is not the region of the location:
say “You’d need some nearby stairs to get there first.”;
stop the action.[/code]

The regional-containment relation is built in somewhere pretty deep, but there’s a section in WWI that mentions the test “is regionally in” as always being interpreted to be about the room/region sense of “in”. A quick dive into the Standard Rules shows that “to be regionally in” is mapped to the reversed regional-containment relation, i.e. it can be used to test whether a room is in a given region.

You want the unreversed relation, i.e. the region containing a given room, so that’s what the new verb “to regionally-include” sets up. Then that verb is used in the “to decide which region…” phrase to give "region of " a meaning. Then that "region of " phrase is used in the check rule condition (twice).

Regions legally can be “in” other regions, so be advised that the example above picks a random parent region – I’m not sure it would work correctly in cases of nested regions.