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
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Mon Dec 21, 2009 5:31 am   

updating locations on the map
 
An image of Zeke at &myloc appears before you.
-----------------------------------------------------------------------------
#VAR mylocnum %mapquery("[Name] LIKE '%@myloc%'")
#te @mylocnum

This doesn't work. Looks like the value of @myloc isn't being passed inside the %mapquery fucnction.
I just want the mapper to update my location upon the trigger text.
Also I would like to plot my enemies location on the map using the same method, thus giving me a path to them.
If there is a way to make something like this work, gimme a hint will ya?
Thanks.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Dec 21, 2009 1:41 pm   
 
That's because the @myloc is within the quotation marks, which makes it a literal string rather than a variable name to be expanded. Try this:
Code:
#VAR mylocnum %mapquery(%concat("[Name] LIKE '%", @myloc, "%'"))
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Dec 21, 2009 1:45 pm   
 
For the second part, you could do something like:
Code:
#pathhigh %pathfrom(,@mylocnum)

But to make either of these things work, you also have to be sure that @mylocnum is a single number, in other words, that the %mapquery returns only a single number, not a list of room numbers.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Mon Dec 21, 2009 5:38 pm   
 
I ought to mention something else, to whet your appetite for the new version of Cmud. Version 3.xx, currently in beta testing, includes a major rewrite of the mapping system. One of the new features is the ability to mark and keep track of multiple locations. You normally have one location for yourself, but you could add other locations for other people, pets, or whatever. They would be marked on the map the same way your own location is marked, but you could specify a different color for each. You can dynamically change which location object gets tracked (moved with movement commands), though that's not necessary for your current needs. Something to look forward to!
Reply with quote
dazed-n-confused999
Wanderer


Joined: 03 Aug 2004
Posts: 79

PostPosted: Tue Dec 22, 2009 12:57 am   
 
Thanks Rahab!
That did the trick, and those new mapper options might be worth looking into.
Reply with quote
gamma_ray
Magician


Joined: 17 Apr 2005
Posts: 496

PostPosted: Mon Dec 28, 2009 1:20 am   
 
Rahab wrote:
That's because the @myloc is within the quotation marks, which makes it a literal string rather than a variable name to be expanded. Try this:
Code:
#VAR mylocnum %mapquery(%concat("[Name] LIKE '%", @myloc, "%'"))

I was reading some old stuff the other day and came upon this gem.
Zugg wrote:
The {} is a string that allows variables to be expanded. Remember that {} is just like " except that it allows variable expansion.

And then I switched all my mapquery stuff to, for example,
Code:
#VAR mylocnum %mapquery({[Name] LIKE '%@myloc%'})

which sure looks a lot prettier.
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