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


Joined: 08 Feb 2008
Posts: 2

PostPosted: Sat Feb 23, 2008 12:00 am   

Parameterized query help needed
 
Hi all,

#show %query(&MobName = "wenumic the roach") returns record ids as expected, unfortunately I can't figure out how one can pass mobname as a parameter.
I tried creating an alias 'test' as #show %query(&MobName = %1) which is not working (test "wenumic the roach").
Could someone help me with the syntax, please?
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 23, 2008 12:28 am   
 
In the alias change %1 to %-1
Code:
#show %query(&MobName = %-1)
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Dimonytch
Newbie


Joined: 08 Feb 2008
Posts: 2

PostPosted: Sat Feb 23, 2008 12:47 am   
 
No luck Sad
Void result either.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Sat Feb 23, 2008 1:48 am   
 
Yeah Lame :(, I think query is kinda funky.
but if use a lua alias or func it should work out alright.

Code:
<alias name="test" language="Lua" id="23">
  <value>print( zs.func.query('&amp;Name = "'..zs.params(1)..'"'))
</value>
</alias>



Code:
print( zs.func.query('&Name = "'..zs.params(1)..'"'))
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Sat Feb 23, 2008 11:45 am   
 
I haven't use Lua yet, however, I do use %query with parameters in at least one function. As follows:
Code:

$room = %-1
....
$rec = %find( $room, All|@MasterDB, Area)
....
gprec = %dbget($rec)
....

and it works just fine.

Edit: oops, wrong function, sorry.
_________________
Sic itur ad astra.
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