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


Joined: 01 Jul 2004
Posts: 2
Location: USA

PostPosted: Fri Jul 02, 2004 12:12 am   

Need help with DB's
 
Well, I've never used zmud's db's before, and I'm having a LOT of trouble understanding the commands. So, after searching the forums (yes, I did) and reading the (not-so)help files, I've finally broken down to just asking someone here to make it for me.
I want to record the items I identify, and log them into the DB. Now, i'm not doing eq, so this is getting a lot easier. I just want potions. Here's the output of id:

+-----------------------------------------------------------------+
| Names : mug of ale |
| Desc : Mug of Ale |
| Type : Potion Level : 80 |
| Worth : 1,280 Weight : 13 |
| Wearable : take |
| Flags : glow hum magic burn-proof |
| Clan Item : From The Hook Clan |
+-----------------------------------------------------------------+
| Spells : |
| Level 80 spell of 'adrenaline control' |
| Level 80 spell of 'champions strength' |
| Level 80 spell of 'aid' |
| Level 80 spell of 'intellect fortress' |
+-----------------------------------------------------------------+
(please note that in the mud, all |'s align at the right.)

I need to record the values of the name(Name), level(Level), clan item(Locaton), and each of the spell names (Spell1, Spell2, Spell3, Spell4).

Here's what I have so far:

#CLASS 0
#ALIAS {dbadd} {#T+ potiondb;#DBLOAD potions;c idein %1}

#CLASS {potiondb}
#TRIGGER {^~| Spells ~:}{#var dbcounter 1}
#TRIGGER {^~| Level (%d) spell of ~'(*)~'"} {#math dbcounter (@dbcounter+1)}
#TRIGGER {^~| Names ~: (*)} {#var ......}
#TRIGGER {^~| Type ~: Potion Level ~: (%d) ~|$} {#var .......}
#TRIGGER {^~| Clan Item ~: From (%w)} {#var ......}

The formatting is off because of this forum post, but if someone could make me the triggers, I could fix that. I just have no clue what I'm doing with the command for the DB :(

Thanks in Advance!
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Jul 02, 2004 2:02 am   
 
It's easiest to add information to a database using a record variable. Something like this:

#CLASS 0
#ALIAS {dbadd} {#VAR PotionDB {};#T+ potiondb;#DBLOAD potions;c idein %1}
#CLASS {potiondb}
#TRIGGER {^~| Spells %s :} {#VAR dbcounter 0}
#COND {+-----} {#NEW All @PotionDB}
#TRIGGER {Level (%d) spell of ~'(*)~'} {#ADD dbcounter 1;#ADDKEY PotionDB Spell@dbcounter {%2}}
#TRIGGER {^~| Names %s : (*)~|} {#ADDK PotionDB Name {%trim( %1)}}
#TRIGGER {Level %s: %s (%d)} {#ADDK PotionDB Level {%1}}
#TRIGGER {^~| Clan Item %s: From (*)~|} {#ADDK PotionDB Location {%trim( %1)}}
#CLASS 0
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