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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
adamandkate
Wanderer


Joined: 14 Oct 2009
Posts: 57

PostPosted: Sun Nov 29, 2009 11:43 am   

Is there a better way to do this %mapquery
 
I have a trigger that when i try to find my current location, it takes the room name, querys the map. And teleports my current location to that point.

#var locating {}
#var room2find {}
#var found_rooms {}
#var numberrooms {}
room2find = %replace( %1, ', %)
foundrooms = %mapquery( %concat( "Name LIKE '%", @room2find, "%'"))
currentroom = %item( @foundrooms , 1)
#wait 500
#teleport %item( @foundrooms, 1)

Now in the latest cmud its a LOT LOT LOT faster. (it ROCKS, thanks zugg!) But it does still lagg, so wondered if there was a better way of doing this.

thanks

edit - i know the #wait is bad. i will change that to a waitfor or something
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Nov 29, 2009 6:32 pm   
 
Use %mapfilter() to cut down on the number of rooms that it searches. The lag is probably happening due to having to search the entire map.

You'll want two calls, like so:
#call %mapfilter(the stuff that limits the query)
...
#call %mapfilter("")
_________________
EDIT: I didn't like my old signature
Reply with quote
adamandkate
Wanderer


Joined: 14 Oct 2009
Posts: 57

PostPosted: Wed Dec 02, 2009 12:14 am   
 
thanks for that. works a lot better!
Reply with quote
adamandkate
Wanderer


Joined: 14 Oct 2009
Posts: 57

PostPosted: Fri Dec 11, 2009 12:01 am   
 
actually, i know im being stupid.. but is it simply...


#call %mapfilter(ZoneID = 56)

#call %mapfilter("")

i feel like im missing some quotes. but cant work out how to put em

thanks again
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Dec 11, 2009 1:56 pm   
 
Yes, %mapfilter() requires quotes around the SQL string, just like %mapquery(). So, %mapfilter("ZoneID = 56") would work. If you need to evaluate some variables or functions in the SQL string, you can either do it outside the function:
Code:
$myfilter = %concat("ZoneID = ",%zonenum())
#call %mapfilter($myfilter)

or do it all in one line:
Code:
#CALL %mapfilter(%concat("ZoneID = ",%zonenum()))
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Fri Dec 11, 2009 7:54 pm   
 
I'm missing something--what are you doing that isn't done by #find?
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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