Scenery/ visible exits(Trust me, it works)
sonic102
11 Jul 2012, 00:23Now you can make a scenery/ visible exit through my idea!
Things to copy from Core
defaultexit(Object Types)
ScopeExitsForRoom(Functions)
Go(Commands)
Method
1.To the defaultexit type, add two new attirbutes(visible and scenery). Set visible to true and scenery to false.
2.Edit the ScopeExitsForRoom script like the below given code.[1]
3.Edit the Go script like the below given code.[2]
How To Use
If you want an exit to not even exist, set e.visible to false where e is the exit name. Just like invisible objects.
If you want an exit to exist, but invisible to the player, set e.scenery to true where e is the exit name. Just like scenery objecs.
Codes
[1]
[2]
Things to copy from Core
defaultexit(Object Types)
ScopeExitsForRoom(Functions)
Go(Commands)
Method
1.To the defaultexit type, add two new attirbutes(visible and scenery). Set visible to true and scenery to false.
2.Edit the ScopeExitsForRoom script like the below given code.[1]
3.Edit the Go script like the below given code.[2]
How To Use
If you want an exit to not even exist, set e.visible to false where e is the exit name. Just like invisible objects.
If you want an exit to exist, but invisible to the player, set e.scenery to true where e is the exit name. Just like scenery objecs.
Codes
[1]
<function name="ScopeExitsForRoom" parameters="room" type="objectlist">
result = NewObjectList()
foreach (exit, AllExits()) {
if (exit.parent = room and not GetBoolean(exit, "lookonly")) {
if (exit.visible = true) {
if (exit.scenery = false) {
list add (result, exit)
}
}
}
}
return (result)
</function>
[2]
<command name="go">
<pattern type="string"><![CDATA[^go to (?<exit>.*)$|^go (?<exit>.*)$|^(?<exit>north|east|south|west|northeast|northwest|southeast|southwest|in|out|up|down|n|e|s|w|ne|nw|se|sw|o|u|d)$]]></pattern>
<unresolved>You can't go there.</unresolved>
<script>
if (exit.locked) {
msg (exit.lockmessage)
}
else if (HasScript(exit, "script")) {
do (exit, "script")
}
else {
if (exit.lookonly) {
msg ("You can't go there.")
}
else {
if (exit.visible) {
player.parent = exit.to
}
else {
msg ("You can't go there.")
}
}
}
</script>
</command>