Here is the code I am using, this affects all rooms which inherit it.
<type name="BaseRoom">
<marked type="int">0</marked>
<RoomType type="string"></RoomType>
<RoomDescription type="string"></RoomDescription>
<description type="script"><![CDATA[
// Then in your description code.
exitlist = NewList()
if (HasExit(0)) {
list add (exitlist, "forward")
}
if (HasExit(1)) {
list add (exitlist, "right")
}
if (HasExit(2)) {
list add (exitlist, "back")
}
if (HasExit(3)) {
list add (exitlist, "left")
}
// Then generate the string from it
// Stolen from the Quest core's FormatExitList function
s = "You can go "
count = 0
length = ListCount(exitlist)
foreach (exit, exitlist) {
s = s + exit
count = count + 1
if (count = length-1) {
s = s + " or "
}
else if (count < length) {
s = s + ", "
}
}
s = s + "."
if (count = 1) {
game.pov.parent.alias = "Dead End"
game.pov.parent.RoomDescription = "You are standing at a dead end "
}
else if (count = 2) {
if (HasExit(0)) {
game.pov.parent.alias = "Long Corridor"
game.pov.parent.RoomDescription = "You are walking along a very long corridor "
}
else {
game.pov.parent.alias = "Sharp Bend"
game.pov.parent.RoomDescription = "You have reached a sharp bend in the corridor "
}
}
else if (count = 3) {
game.pov.parent.alias = "T-Junction"
game.pov.parent.RoomDescription = "You are standing at a T-Junction "
}
else if (count = 4) {
game.pov.parent.alias = "Crossroads"
game.pov.parent.RoomDescription = "You are standing at a crossroads "
}
msg (game.pov.parent.RoomDescription + "in a maze of dark, twisty passages that all look the same.")
if (game.pov.parent.marked = 0) {
}
else {
msg ("The number " + game.pov.parent.marked + " has been drawn on to the wall in marker pen.")
}
msg (s)
]]></description>
</type>
<function name="ChangeRoom" parameters="dir">
room = game.pov.parent
if (HasAttribute(room, "exit" + dir)) {
newroom = GetAttribute(room, "exit" + dir)
// Set new player direction.
game.pov.dir = GetInt(room, "exitdir" + dir)
// msg ("Debug: move to room " + newroom.name + ", facing dir " + game.pov.dir)
if (newroom = room) {
// Same room. Force room description dump, etc
OnEnterRoom (room)
}
else {
// New room. Just move.
game.pov.parent = newroom
}
}
else {
msg ("You can't go that way.")
}
</function>
<function name="HasExit" parameters="dir" type="boolean">
dir = (game.pov.dir + dir) % 4
return (HasAttribute(game.pov.parent, "exit"+dir))
</function>