|
ydcol_o Newbie
Joined: 26 Jan 2005 Posts: 2
|
Posted: 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! |
|
|
|
Slaem Apprentice
Joined: 20 Sep 2005 Posts: 135
|
Posted: 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.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: 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 |
|
|
|
ydcol_o Newbie
Joined: 26 Jan 2005 Posts: 2
|
Posted: Tue Dec 06, 2005 3:42 am |
I got it,
Thanks for your wonderful code,vijilante |
|
|
|
|
|
|
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
|
|