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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
xekon
Apprentice


Joined: 11 Oct 2007
Posts: 154

PostPosted: Thu Oct 25, 2007 9:44 pm   

Please help me with a simple prompt macro, i cant figure out what is wrong
 
I have an ifind alias which connects to an equipment database and then returns matches.
The ifind alias is for Aardwolf mud and is available here: http://www.conradshome.com/iwuvzmud/

If I enter the following into the commandline it works perfectly fine and returns all matches that have the string Endless within the item name

ifind name LIKE "%Endless%"

Here is what I was trying to do: (this one appears to set the variable correctly but the variable does not return the "" marks it simply uses them to dictate that the contents are a string)

#prompt iditem {what would you like to ID?}
iditem=~"%@iditem%"
ifind name LIKE @iditem

I also tried:

#prompt iditem {what would you like to ID?}
ifind name LIKE ~"%@iditem%"
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Thu Oct 25, 2007 10:28 pm   
 
Change this line in the ifind alias
Code:
#VARIABLE rs @conn.Execute("SELECT * FROM iwuvaard.equipment WHERE %-1 ORDER BY equip_id ASC")

to this
Code:

#IF (%numparam=0) {
 #VARIABLE rs @conn.Execute(%concat("SELECT * FROM iwuvaard.equipment WHERE name LIKE '",@iditem,"' ORDER BY equip_id ASC"))
} {
 #VARIABLE rs @conn.Execute("SELECT * FROM iwuvaard.equipment WHERE %-1 ORDER BY equip_id ASC")
}

Change you macro to this
Code:
#PROMPT iditem {What item name do you wish to search}
ifind
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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