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


Joined: 15 Jan 2002
Posts: 4
Location: USA

PostPosted: Thu Oct 03, 2002 5:44 am   

Scripting database entries
 
Hello all,
I was wondering if someone could help me out a bit. I am trying to get a script to enter data into a database. I have created a database and have configured the fields that I want. I have created the triggers to get the variables from the identify spell but I am having trouble getting those variables into the database. This is what I have so far:

#addkey newdata {Name=@dname|Dam=@ddmg|ATT=@dhit|Dmg=@ddmg|ATT=@datt|align=@dalign|class=@dclass|abilities=@ability|races=@drace|rarity=@drare|AC=Dac|hand=@dhand|type=@dtype|mag=@dmag|blss=@dblss|frag=@dfrag|}

Align, class, rarity... are my field names in the database. I used “newdata” because I saw it in another post and thought maybe this was the syntax for adding a record to a database. Thanks for any help you can give me. I will include a sample “identify” spell result although I had no trouble making triggers for the spell.

663/663H 894/894M 513/513Mv >
cast 'improved identify' mantle

Okay.
A Holy Mantle weighs 1 pound, and is very valuable.
It is usable by all alignments.
It is usable by all races.
It is usable by the following classes: Cl
Only a handful of these are in existence.
It will give you following abilities: Det_Align
It is magical. It is blessed. It is a holy or unholy item.
It lowers your armor class by a great deal.
Can affect you as:
Increases Damage Roll by a miniscule amount.
663/663H 858/894M 513/513Mv >
Reply with quote
Troubadour
GURU


Joined: 14 Oct 2000
Posts: 556
Location: USA

PostPosted: Thu Oct 03, 2002 7:10 am   
 
The command that actually puts the information into the database is the #NEW command.

#NEW All @newdata

or directly, without the @newdata variable:

#NEW All {Name=@dname|Dam=@ddmg|ATT=@dhit|Dmg=@ddmg|ATT=@datt|align=@dalign|class=@dclass|abilities=@ability|races=@drace|rarity=@drare|AC=Dac|hand=@dhand|type=@dtype|mag=@dmag|blss=@dblss|frag=@dfrag}

In both examples, "All" is the view.

The newdata variable is used to temporarily store all of the information rather than creating almost twenty variables to temporarily store each piece of information.

Troubadour
(Win 98, Pentium III, 550 MHz)
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