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
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Tue Jan 10, 2006 4:45 am   

#loop and #loopdb help
 
I have used :
#LOOPDB %rec {#if ((%val != "") AND (%val != 0) AND (%key != "Weight" AND (%key != "GoldValue") AND (%key != "Num") AND (%key != "iddate") AND (%key != "whoid"))) {#SHOW %key "=" %val}}
to display a list of non blank, non zero field values for a given database record. however, I am trying to loop this command to allow myself to use the find and dbget commands to find all records containing a certain name, then one by one perform the above referenced loopdb expansion on them for example, in my database i might have two names:
big sword and little sword so I set my alias to dbchecker, so I type
dbchecker sword --- into the prompt line
#var tempdb "%-1"--- this will capture sword to tempdb
#var templist %find( @tempdb, all) ---this will give me a list of the record numbers that have sword in their name
then somehow i need to use dbget and #loop and probably a different variable other than %rec to pass each of the records into the #loopdb expression below...
#LOOPDB %rec {#if ((%val != "") AND (%val != 0) AND (%key != "Weight" AND (%key != "GoldValue") AND (%key != "Num") AND (%key != "iddate") AND (%key != "whoid"))) {#SHOW %key "=" %val}}
as a display, i would like to see a list of the field keys and values for each of the entries that has sword in the name.
I just can't seem to figure out how to finish this thing... any help would be appreciated..
Reply with quote
jed
Adept


Joined: 18 Dec 2005
Posts: 246

PostPosted: Tue Jan 10, 2006 5:50 am   
 
Sorry, but i found the way to do it... I used #forall instead of #loop

#forall @tempdb4 {
#var ttt2 {%dbget( %i)}
#cr
#loopdb @ttt2 {#if ((%val != "") AND (%val != 0) AND (%key != "Weight" AND (%key != "GoldValue") AND (%key != "Num") AND (%key != "iddate") AND (%key != "whoid"))) {#SHOW %key "=" %val}}
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