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
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Tue Aug 20, 2002 2:10 am   

Another DB debug problem
 
PLEASE help me :( I can't figure out why this doesn't work. First the script:

#VARIABLE dbcheck %numitems( %find( @ana_name, armour))
#VARIABLE dbrec %find( @ana_name, armour))
#IF !(@dbcheck) {#NEW armour {Name=@ana_name|Type=@ana_type|Edged=@edged_ac|Blunt=@blunt_ac|Fire=@fire_ac|Ice=@ice_ac|Acid=@acid_ac|Mind=@mind_ac|Poison=@poison_ac|Date=%time( yymmdd)}} {
   #DBGET @dbrec
   #IF ((%rec.date+200)<%time( yymmdd)) {#DBPUT @dbrec {Name=@ana_name|Type=@ana_type|Edged=@edged_ac|Blunt=@blunt_ac|Fire=@fire_ac|Ice=@ice_ac|Acid=@acid_ac|Mind=@mind_ac|Poison=@poison_ac|Date=%time( yymmdd)}
   }


OK, what this script does (and it's not the entire script, just the part that i believe is broken) is check armour, and add it to the database, if it's not already there ... if it is already there, it is SUPPOSED to check the date, and if it's older than 2 months, it updates the rec. The script adds new recs just fine, however it does not update recs ... maybe it's with how i'm using the #DBPUT? please help

Father Horks
The only problem with computer security, is when you think it exists.
Reply with quote
horks
Apprentice


Joined: 20 Jul 2001
Posts: 127
Location: USA

PostPosted: Tue Aug 20, 2002 7:03 pm   
 
Well, after this sat for a couple days and no one responded, I scraped the whole script, and re-wrote it.

When I re-wrote it, I thought "why check the date? why not just update every record if it already exists?" So here's the script I came up with (very different from the origional):

#VARIABLE dbcheck %numitems( %find( @ana_name, armour))
#VARIABLE dbrec %find( @ana_name, armour))
#IF !(@dbcheck) {#NEW armour {Name=@ana_name|Type=@ana_type|Edged=@edged_ac|Blunt=@blunt_ac|Fire=@fire_ac|Ice=@ice_ac|Acid=@acid_ac|Mind=@mind_ac|Poison=@poison_ac|Date=%time( yymmdd)}} {
#DBPUT @dbrec {Name=@ana_name|Type=@ana_type|Edged=@edged_ac|Blunt=@blunt_ac|Fire=@fire_ac|Ice=@ice_ac|Acid=@acid_ac|Mind=@mind_ac|Poison=@poison_ac|Date=%time( yymmdd)}
}

This script is tested, and it works. Basically, all i did was remove the #DBGET (why DBGET, if i'm going to use DBPUT?) and the #IF command that checked the date ... Sorry I didn't make it pretty, I'm in a hurry :P

Father Horks
The only problem with computer security, is when you think it exists.
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