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
zeiuszeppo
Novice


Joined: 22 Nov 2001
Posts: 48
Location: Italy

PostPosted: Tue Feb 12, 2002 1:56 pm   

use a DB
 
I created a db with 3 field and a lot of records. Now I want to loop throught the
first field to match a string e getting
the second and third field of that record.
How can I do?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Feb 12, 2002 6:19 pm   
 
You don't have to loop through the record, you can use the %find function and it returns a list of records that contain the specified string in the first field. You can loop through the returned list and use %dbget to retrieve that record and %db get the other fields. Example, suppose the database has three fields named: name, level, value
#FORALL %find("red") {#SH Level: %db(%dbget(%i), "level") Value: %db(%dbget(%i), "value")}

will find all of the records in the database that have the word "red" in the first field and display the contents of the field "level" and "value"

Kjata
Reply with quote
zeiuszeppo
Novice


Joined: 22 Nov 2001
Posts: 48
Location: Italy

PostPosted: Tue Feb 12, 2002 11:13 pm   
 
how can i obtain the nth recond from a DB
using DBGET?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Feb 12, 2002 11:54 pm   
 
%dbget(n)

Kjata
Reply with quote
zeiuszeppo
Novice


Joined: 22 Nov 2001
Posts: 48
Location: Italy

PostPosted: Wed Feb 13, 2002 12:04 am   
 
I wirte this alias to load the db MobDispelScrap.db
#DBLOAD MobDispelScrap
#SH %db( %dbget( 1), "Key")
but the alias return me a clean line, but
the first record is full
Where is the error?
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Feb 13, 2002 1:09 pm   
 
Is the Database Module Window open?

Kjata
Reply with quote
zeiuszeppo
Novice


Joined: 22 Nov 2001
Posts: 48
Location: Italy

PostPosted: Wed Feb 13, 2002 1:12 pm   
 
I changed my alias to use a list, please help
me here:
http://www.zuggsoft.com/forum/topic.asp?TOPIC_ID=5729&FORUM_ID=7&CAT_ID=1&Topic_Title=using+list&Forum_Title=zMUD+General+Discussion
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