some of these things are a bit advanced... showing an example in code as it's quick and easy for me to do (I'm lazy), lol ...
(if you don't know code, it'll take more time to walk you through using the GUI~Editor)
(I'm not sure if this will work... as I'm not sure about the 'Getobject()' Function/Script... if not, there's the iteration method using ObjectLists)
(another way to check if a room exists as well as a possibly desired additional condition, is the built-in 'visited' Boolean Attribute)
<object name="room">
<attr name="type_of_object" type="string">room</attr>
</object>
<object name="player">
<attr name="type_of_object" type="string">pc</attr>
</object>
<object name="orc">
<attr name="type_of_object" type="string">npc</attr>
</object>
<object name="tree">
<attr name="type_of_object" type="string">tree</attr>
</object>
<object name="teleporter">
<attr name="type_of_object" type="string">teleporter</attr>
<attr name="teleport" type="script">
teleporter_function
</attr>
<attr name="displayverbs" type="simplestringlist">teleport</attr>
</object>
<verb>
<property>teleport</property>
<pattern>teleport</pattern>
<defaultexpression>Sorry, you can't teleport for whatever the reason</defaultexpression>
</verb>
<function name="teleporter_function">
msg ("Enter location")
get input {
if (not GetObject (result) = null and not player.parent = GetObject (result) and GetString (GetObject (result), "type_of_object") = "room") {
player.parent = GetObject (result)
} else if (GetObject (result) = null) {
msg ("The object doesn't exist")
} else if (player.parent = GetObject (result)) {
msg ("You're already at this very location, silly.")
} else {
msg ("The object is not a room.")
}
}
</function>
----------
example using iteration/looping and Object List Attributes:
<object name="room">
<attr name="type_of_object" type="string">room</attr>
</object>
<object name="player">
<attr name="type_of_object" type="string">pc</attr>
</object>
<object name="orc">
<attr name="type_of_object" type="string">npc</attr>
</object>
<object name="tree">
<attr name="type_of_object" type="string">tree</attr>
</object>
<object name="teleporter">
<attr name="type_of_object" type="string">teleporter</attr>
<attr name="teleport" type="script">
teleporter_function
</attr>
<attr name="displayverbs" type="simplestringlist">teleport</attr>
</object>
<verb>
<property>teleport</property>
<pattern>teleport</pattern>
<defaultexpression>Sorry, you can't teleport for whatever the reason</defaultexpression>
</verb>
<function name="teleporter_function">
msg ("Enter location")
get input {
foreach (object_variable, AllObjects()) {
if (object_variable = Getobject (result) and not player.parent = GetObject (result) and GetString (GetObject (result), "type_of_object") = "room") {
player.parent = GetObject (result)
}
}
if (GetObject (result) = null) {
msg ("The object doesn't exist")
} else if (player.parent = GetObject (result)) {
msg ("You're already at this very location, silly.")
} else {
msg ("The object is not a room.")
}
}
</function>