The dot operator may be used as a short-cut when specifying a path in the DM code tree. Instead of specifying the full path, you can start a path with a dot and the compiler will search up in the code tree for the following node. This is known as a relative path with an “upward” search.
Here are the beginnings of a text MUD that allows you to walk around between rooms using the arrow keys. The links between rooms are created in this example by referencing the object type of the destination room. Since there could potentially be a lot of rooms, they are grouped into sub-classes, and to avoid lengthy type paths such as /area/Village/Square, they are referenced using a relative path from the point of reference.
area
var/area
north_exit
south_exit
east_exit
west_exit
Entered(O)
O << name
return ..()
Castle
Main_Gate
north_exit = .Castle_Entryway
south_exit = .Moat_Bridge
Castle_Entryway
south_exit = .Main_Gate
Moat_Bridge
north_exit = .Main_Gate
south_exit = .Village/Guard_Post
Village
Guard_Post
north_exit = .Castle/Moat_Bridge
south_exit = .Square
Square
north_exit = .Guard_Post
//handle movement
client/Move(Dest,Dir)
var/area/room = usr.loc
if(istype(room)) //in a room
switch(Dir)
if(NORTH) Dest = room.north_exit
if(SOUTH) Dest = room.south_exit
if(EAST) Dest = room.east_exit
if(WEST) Dest = room.west_exit
return ..()
//set the starting position for new logins
mob/Login()
if(!loc) Move(locate(/area/Castle/Main_Gate))
return ..()