 |
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Mon Dec 19, 2005 11:49 pm
databaser |
I have this setup to automatically database things i see in rooms, an example of it is:
Code: |
#tr {~(a~)&armor.name} {#var armor.vnum %roomnum
#var armor.zone %zonenum
#if (@database = 1) {#if (%find( @armor.name, name)&%query( %zonename( @armor.zone), zone)) {} {#NEW items {name=@armor.name|vnum=@armor.vnum|zone=@armor.zone|type="armor"}}} {}} |
I have 2 problems with it. what i want to do is if database = 1 to check if the current name and zone are already in the database, and if not to add the new information. the problems are it is adding the information even if it already exists, sometimes the database will have a blank zonename. i have the fields setup so vnum=room, zone=zone. also, i was wondering of a faster way to process the information since these queries make me lag a bit. |
|
|
 |
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Thu Jan 05, 2006 12:50 am |
...anyone see the error here or have some suggestions? i really want to implement this script but it just keeps filling my database up with existing items/mobs/object/armor/weapons
|
|
|
 |
Iceclaw Apprentice
Joined: 11 Sep 2005 Posts: 124
|
Posted: Thu Jan 05, 2006 1:01 am |
Untested, but try :
#tr {~(a~)&armor.name} {#var armor.vnum %roomnum()
#var armor.zone %zonenum()
#if (@database = 1) {
#if (%query((&Name=@armor.name)&(&Zone=@armor.zone)))="" {#NOOP} {#NEW item {name=@armor.name|vnum=@armor.vnum|zone=@armor.zone|type="armor"}} |
|
|
 |
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Thu Jan 05, 2006 9:04 pm |
still adds repeat entries
|
|
|
 |
Iceclaw Apprentice
Joined: 11 Sep 2005 Posts: 124
|
Posted: Thu Jan 05, 2006 9:37 pm |
Looks like you have your {#NOOP} {#NEW} reversed, if its null, you dont want it to do nothing, you only want it to do nothing if it is null.
|
|
|
 |
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Fri Jan 06, 2006 12:44 am |
i don't want it to do anything if the entry exists, so i want the false statement to fire. i fixed it up by doing #if (%query((&Name=@armor.name)&(&Zone=@armor.zone))) {#NOOP} {#NEW item {name=@armor.name|vnum=@armor.vnum|zone=@armor.zone|type="armor"}} which seemed to worka bit better, but it will still randomly start adding existing entries after working well for a few minutes.
|
|
|
 |
|
|