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

Joined: 16 Jun 2004
Posts: 6
Location: USA

PostPosted: Fri Apr 22, 2005 11:55 pm   

Flaky database behaviour! seems like it goes online/offline
I'm making a script to parse a list of groupmembers and fire a heal spell on the one most hurt. I'm using a database to store the data. I've fought a battle with zmud databases before and won. This time I can't seem to eradicate the flakiness.

Here's the main sequence I'm having difficulty with. When joining a group I load the records as I need persistent data on each member to correctly use another cleric spell, vitality. (+300 hps)

[ghinit] alias
#VAR ghlGroupHealInit 1
#VAR ghlUngagGroupList 1
#SAY Initializing the GroupHeal/Vit database...
#SEND group

[*%s&ghlMemberHP/&ghlMemberHPmax*hit,*move, %s%d/%d%s%w?&ghlMemberName] trigger
#IF (@ghlGroupHealInit = 1) {
#VAR ghlGroupMemberRecord %null
#DBLOAD dbAutoHealVit
#ADDKEY ghlGroupMemberRecord {Name=@ghlMemberName|HP=@ghlMemberHP|MaxHP=@ghlMemberHPmax|MaxHPbase=@ghlMemberHPmax}
#NEW dbAutoHealVit @ghlGroupMemberRecord

Sometimes the #NEW adds a record and sometimes not.

On the command line, sometimes issuing #DBLOAD dbAutoHealVit; #NEW dbAutoHealVit @ghlGroupMemberRecord will add a record, sometimes not. If it does add, it will continue to add until mysteriously turning off.

I use this script to wipe the db clean:
#DBLOAD dbAutoHealVit
#SAY %numrec( )
#LOOP (%numrec( )) {
#SAY %numrec( ) @rec.num
#DBDELETE %rec.num

Sometimes it works, sometimes the db appears to be blank even when by viewing it in the db window I can see records and a minute later the script suddenly seeing those records and working correctly.

It's been flaky from the start of the project but worked most of the time. It's suddenly gone to working almost never and is most frustrating. When I poke the db using the command line it essentially appears as though it randomly goes online and offline.

I've made a spell queue using a database and the same methods of accessing it as I use here and it's worked flawlessly. This is the only db in this character's scripts. I'm wondering if I'll be forced to implement using lists.

Reply with quote

Joined: 08 Jan 2001
Posts: 341
Location: Singapore

PostPosted: Mon May 02, 2005 4:24 am   
Have you used #DBONLINE and #DBOFFLINE?
Reply with quote

Joined: 16 Jun 2004
Posts: 6
Location: USA

PostPosted: Tue May 03, 2005 10:19 am   
Make the db available for scripting? Not very illuminating.

When I implemented a fairly simple queue datastructure with db last fall it worked perfectly without those commands.

I've coded in a lotta languages but only zMUD script and ABLE (for coding circuit schematics on solid state devices) did I find that code with correct syntax didn't yield the advertised results. BASIC, Pascal, C, C##, Java, etc. They all plain work when you write good code. Very frustrating to deal with.

I took the whole script and rewrote it to use lists and it's working fine. DB would be so much nicer though. *sigh*

If you can offer any help I'd be most appreciative.

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