|
Borbarad Newbie
Joined: 10 Feb 2005 Posts: 9
|
Posted: 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 |
|
|
|
Aarlot Adept
Joined: 30 Dec 2003 Posts: 226
|
Posted: 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. |
|
|
|
megamog75 Enchanter
Joined: 20 Nov 2002 Posts: 627 Location: USA
|
Posted: 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
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 |
|
|
|
|
|