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


Joined: 10 Feb 2005
Posts: 9

PostPosted: Thu Feb 10, 2005 4:21 pm   

Adding Records
 
From time to time i see items in the mud i play.
Now i want to add the name of these items into a db.
I used the #new command. When i see one item several
times then for each time one entry is created. That is my problem :-(
If the item already exits then i do not want it to be added.
Any idea how to solve this problem(primary key on columns?, a command to see if a entry is in a table/view?)?
----- Borbarad
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Fri Feb 11, 2005 12:06 am   
 
What I do is, since every item in the mud I have a DB for has a different name, is put all the item's data into a temporary db variable called @item, then #IF (%find(@item.name)) {} {#NEW "" @item}. This eliminates multiple entries. (The "Name" field is the first one in my database, which is why %find works. You might have to use %query if you have some other entry first, or if you have some other way to identify the uniqueness of each item.)
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
megamog75
Enchanter


Joined: 20 Nov 2002
Posts: 627
Location: USA

PostPosted: Fri Feb 11, 2005 12:12 am   
 
Troubadour made a good Equipment Database Script I have used this for years and it is by far one of the best I have seen. You will probably have to tweek it a bit for your mud and I fooled around with mine until I got it to do all sorts of stuff. It became a templeate for alot of other stuff I wrote later on.

That link is HERE
_________________
megamog75 Smile
I will do this.Nothing in my life matters except this.No moment in my life exists except this moment.I am born in this moment, and if I fail, I will die in this moment. Raistlin Majere
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