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
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Fri Jul 20, 2012 7:20 pm   

weird mapquery problems
 
ok so im getting this weird problem while using mapquery in an alias, here is a working examples

Code:

<alias name="roomnamecpmob" id="744">
  <value>$foo={The Navigation System}
#forall $foo {
  $room=%mapquery( "[Name] LIKE '"%i"'")
  #show $room"- "%zonename( %roomzone( $room))
  }</value>
</alias>

it outputs 9538|9582- Storm Ships of Lem-Dagor like expected
but when i use the following
Code:

<alias name="areawhere" id="745">
  <value>$room=%mapquery("[Name] LIKE '"%1"'")
#echo $room"- "%zonename( %roomzone( $room))</value>
</alias>

using the same room name it outputs
- manor3
which is really not what i wanted, and i cant figure out why its doing it,

thanks in advance for the help
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri Jul 20, 2012 8:27 pm   
 
How are you executing the alias?
If you execute
Code:
areawhere "The Navigation System"
your alias will work.
If you execute
Code:
areawhere The Navigation System
your aliase won't work because %1 will only be "The".

If you want to be able to use the alias in that second form, change %1 to %params in your alias.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sun Jul 22, 2012 12:53 pm   
 
I find your %mapquery parameter a bit odd. You are using LIKE but you are not going to get rooms whose names contain your string. it should be:
Code:

...
$room = %mapquery( ("[Name] LIKE '%" + %i + "%'") )
...

either "%" is optional, but you need at least one if you want a generic search. As it stands now what you have is a case-insensitive match request.

Unless, of course, you are passing ("'%" + room_string + "%'") as part of your parameter, in which case, everything is fine.

I agree with Rehab that your problem is the lack of quotes around the string (though you could change %1 to %-1 and it would work).
_________________
Sic itur ad astra.
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Sun Jul 22, 2012 4:12 pm   
 
al i ment it for was case-insensitive, if i cant find a room in my mapper with the name then when i pass to the script i throw the % in where i need it
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 22, 2012 4:27 pm   
 
SQL is always case-insensitive. It won't matter if you search for "The Navigation System", "The navigation system", "the Navigation system", or any other combination of capitalization. SQL treats it all the same and will return all results from either case.
_________________
EDIT: I didn't like my old signature
Reply with quote
hadar
Apprentice


Joined: 30 Aug 2009
Posts: 198
Location: my apt, in california

PostPosted: Sun Jul 22, 2012 4:51 pm   
 
nwo if you do [Name]='string' ... it has to be exact
_________________
if you build it they will come, assuming that they have not already come to build it
Aardwolf Bootcamp
My youtube channel
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