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
ydcol_o
Newbie


Joined: 26 Jan 2005
Posts: 2

PostPosted: Wed Nov 30, 2005 5:50 am   

same roomname&roomdesc
 
I want to use #Find to set the current location on the map, but there are many rooms which have the same name and desc. So #Find will set a wrong room.The only different thing is 'exit', but i can't solve it myself.

My english is poor, forgive me for the expression

Help me please!
Reply with quote
Slaem
Apprentice


Joined: 20 Sep 2005
Posts: 135

PostPosted: Wed Nov 30, 2005 7:30 am   
 
Sorry, but there's no easy way to do this. This question has been asked before, so you could Search for those posts for ideas. But, I don't think there's a solution available for identical room names and descriptions.
_________________
Show your love.
Support Zugg Software!
Donate to zugg@zuggsoft.com with PayPal Send Money.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Wed Nov 30, 2005 9:20 am   
 
The method I use is a little to complex to post, but the short of it is preform a %mapquery for the name. If you get multiple matches, prefrom another query for the description. Then keep only those that were returned in both queries.
Code:
PossibleRoom=%mapquery(%concat("([Name]='",@Veroule.RoomName,"') AND ([Desc]='",@Veroule.RoomDesc,"')"))
If you have multiple matches still move on to exit comparison. To do this you have to convert your captured exits into the single characters version defined by your #DIRECTION settings or convert the %roomexit ones to a longer version.
Code:
#FUNCTION DirConvert {%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace(%replace("%1","in","im"),"out","oyt"),"u","up"),"h","nw"),"l","se"),"j","ne"),"k","sw"),"n","north"),"s","south"),"e","east"),"w","west"),"d","down"),"im","in"),"oyt","out")}
Then loop through your query results and retrieve the exit list for that room. With each of those lists you have to compare to make sure it contains all the same elements, and often they are not in the same order. I find the best way to do this is loop through the captured list and #IF (%ismember("%i",@RetrievedRoomExits)) {#DELITEM RetrievedRoomExits {%i}} {#ADDITEM RetrievedRoomExits {%i}}. Then if the variable is not exmpty you don't have a match and you can #DELITEM that room from you list of possibles. If you end up with multiple possibles still then you should report an error and the remainder of the list.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
ydcol_o
Newbie


Joined: 26 Jan 2005
Posts: 2

PostPosted: Tue Dec 06, 2005 3:42 am   
 
I got it,
Thanks for your wonderful code,vijilante
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