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


Joined: 02 Jul 2006
Posts: 2

PostPosted: Sun Jul 02, 2006 11:26 pm   

Database check
 
I'm trying to record mobs and their spells to database.

Like:

'mobname', 'spell'
Bluedragon, 'lightning bolt'
Bluedragon, 'electrocution'
Bluedragon, 'saugaiiiiiiiiiiii'

Problem is how to avoid dublicate records, how to check is there already mob named Blue Dragon and a spell 'lightning bolt' with it in database.

Another question...

How can I list all 'spell' from 'mobname' Bluedragon. I dont want to see all records, just 'spell's.


Thanks
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Jul 03, 2006 1:04 am   
 
#ALIAS SpellDBAdd {#NOOP SpellDBAdd Blue Dragon 'electrocution';#ADDITEM SpellDB.%replace(%copy({%-1},1,%pos("-",{%1})-1)," ","_") %lower(%copy({%-1},%pos("-",{%1})+1,%len({%-1})-1))}
#ALASI SpellDBList {#NOOP SpellDBList Blue Dragon;#SHOW %db(@SpellDB,%replace({%1}," ","_"))}

Something like that.

SpellDBAdd mobname 'spell'
SpellDBAdd Blue dragon 'lightning bolt'
SpellDBAdd Blue dragon 'electrocution'
SpellDBAdd Blue dragon 'saugaiiiiiiiiiiii'

Duplication is avoided as we choose #ADDITEM versus %additem. It tries to add it all but the database record will only have 1 entry for each mob.

You can also:
#SHOWDB @SpellDB
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