Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Fri Nov 17, 2006 4:50 pm   

mapper doubling problem
 
I have a test map with only two rooms:

Map: [1]-[2]

Room 1 to Room 2: turn handle then go east
Room 2 to Room 1: open door then go west

I created the above exit commands with "Other Com:" under "Room Properties", "Exits" tab.

Room 1, Other Com: turn handle;east
Room 2, Other Com: open door;west

input:
#teleport 1
#walk 2

output:
turn handle
east

(same output as above if I click the 2nd room in the 1st room)

input:
#teleport 1
#echo %walk(2)
#exec %walk(2)

output:
.(turn handle;east)
turn handle
turn handle
east

input:
#teleport 1
.(turn handle;east)

output:
turn handle
turn handle
east

How can I stop the mapper from outputting a double "turn handle"?

Here is the walking script I am working on, it works fine except the doubling.

Code:
#class Walking_Script
#var walk_db_room 0 0
#var walk_db_path 0 0
#alias walk {
#if %isnumber(%1) {#loopdb @walk_db_room {#if (%val = %1) {#exec %db(@walk_db_path,%key)}}} {
#call %mapfilter(%concat("Name"," LIKE ","'%",%replace(%-1,"'","''"),"%'"," AND ","ZoneID"," = ",%zonenum))
#var walk_db_room %null
#var walk_db_path %null
#loop %numrooms {#addkey walk_db_room %roomvnum(%i) %i}
#loop %numrooms {#addkey walk_db_path %roomvnum(%i) %walk(%roomvnum(%i))}
#if (%numkeys(@walk_db_room) = 1) {#loopdb @walk_db_room {#if (%val = 1) {#exec %db(@walk_db_path,%key)}}}
#if (%numkeys(@walk_db_room) > 1) {#show {}
#loopdb @walk_db_room {#show {Filter: %format("&5.0f",%val) Virtual: %format("&5.0f",%key) Room: %roomname(%key) %numitems(%exec(%db(@walk_db_path,%key)))|%if(%db(@walk_db_path,%key)=%null,"-",%replace(%db(@walk_db_path,%key),".",""))}}}
#call %mapfilter(%null)}}
#class 0


In the code, the lines with "#exec %db(@walk_db_path,%key)" issue walks.. causes the doubling.

The script searches room names in the current zone.

If the mapfilter finds

1. only one match, then the script issues the walk
2. more than one match, then the script shows each match with its path

>walk maple
west

(there is only one room name that contain "maple" in the zone)

>walk forest
Filter: 1 Virtual: 24 Room: A Forest 'Neath a Spangled Sky 8|nw3nu2n
Filter: 2 Virtual: 26 Room: Forest of Heavy Dreams 8|nw3nune
Filter: 3 Virtual: 27 Room: Immortal Forest 9|nw3nuneu
Filter: 4 Virtual: 28 Room: Forest in Flames 10|nw3nuneue
Filter: 5 Virtual: 30 Room: Forest Burrow 12|nw3nuneuses
Filter: 6 Virtual: 31 Room: Sleepy Forest 13|nw3nuneusese
Filter: 7 Virtual: 37 Room: Sleepy Forest 12|nw3nuneusne

(there are 7 room names that contain "forest" in the zone)

>walk 2
north
west
north
north
north
up
north
east

(which is a walk to "Forest of Heavy Dreams" from the current room)
Reply with quote
Full Throttle
Wanderer


Joined: 07 Dec 2004
Posts: 65

PostPosted: Fri Nov 17, 2006 11:33 pm   
 
got it to work Embarassed

changed "#exec %db(@walk_db_path,%key)" to "#walk %key"
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net