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
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: 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.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: 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
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: 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"}}
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: Thu Jan 05, 2006 9:04 pm   
 
still adds repeat entries
Reply with quote
Iceclaw
Apprentice


Joined: 11 Sep 2005
Posts: 124

PostPosted: 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.
Reply with quote
chris-74269
Magician


Joined: 23 Nov 2004
Posts: 364

PostPosted: 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.
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