Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
rto0288
Beginner


Joined: 23 Apr 2006
Posts: 11

PostPosted: Tue Sep 09, 2008 2:52 pm   

Database Records constantly reverting to Auto-type after manipulated by an Alias
 
I just jumped back into working on my 3/4 completed cmud curing system after a year and a half hiatus. It was all working (mostly) when I left... the only difference on my end is a new laptop with Vista instead of XP (all the previous scripting was on an XP machine). Here's my problem:

I have an alias called 'afflicted' which gets called by triggers when I get afflicted with something. The 'afflicted' alias checks through some Database Records using %iskey in order to figure out what to do about my current affliction. My problem is that every time 'afflicted' is called, it changes the Database Record variable it modifies, into an Auto-Type. I'm finding that once a Database Record is called Auto-Type, %iskey does not work on it. I was initially having a problem with 'afflicted' not working at all and realized that when I go through and change those records from Auto-Type to Database Record, everything works fine and it tries to do the cure... once or twice. Then it stops trying to do the cure and when I check the corresponding database record, the affliction is still set to '0' as if it has been cured. I found that the database was being called Auto-Type so I changed it back to Database Record and then 'afflicted' worked again. Unfortunately these errors seem to be kind of random because now when I reset the database variable to Database Record, 'afflicted' still produces no results and the record is reset to Auto-Type.

For instance if I get poisoned by the Voyria venom (this is achaea) the trigger calls: 'afflicted voyria' which does this:

#IF ($aff==aeon) {aeon=1}
#IF (%iskey(@smokeAfflictions,$aff)) {#VAR smokeAfflictions.$aff 1;smokequeue}
#IF (%iskey(@salveAfflictions,$aff)) {#VAR salveAfflictions.$aff 1;salvequeue}
#IF (%iskey(@eatAfflictions,$aff)) {#VAR eatAfflictions.$aff 1;eatqueue}
#IF (%iskey(@miscAfflictions,$aff)) {#VAR miscAfflictions.$aff 1;drinkqueue}
checkAffs

In this case Voyria will be in the @miscAfflictions database so it should change it's value from 0 to 1 and run 'drinkqueue' which will do this:

#IF (!@sleeping&&!@stunned&&!@aeon&&!@salveAfflictions.anorexia) {#IF @miscAfflictions.voyria {si}}

after all that it runs the 'checkAffs' alias which looks like this:

$smokeAffs=@smokeAfflictions
$salveAffs=@salveAfflictions
$eatAffs=@eatAfflictions
$damLimbs=@damagedLimbs
$miscAffs=@miscAfflictions

#LOOPDB $smokeAffs {#IF (%val) {#ADDI currentAffs %key} {#DELI currentAffs %key}}
#LOOPDB $salveAffs {#IF (%val) {#ADDI currentAffs %key} {#DELI currentAffs %key}}
#LOOPDB $eatAffs {#IF (%val) {#ADDI currentAffs %key} {#DELI currentAffs %key}}
#LOOPDB $damLimbs {#IF (%val) {#ADDI currentAffs %key} {#DELI currentAffs %key}}
#LOOPDB $miscAffs {#IF (%val) {#ADDI currentAffs %key} {#DELI currentAffs %key}}

That alias is just for my status window display to show me anything that hasn't been cured... I've tested without it and it changed nothing. Just put it in here for the sake of thoroughness.

So basically I'm looking at code that I believe should work, in fact I KNOW has worked in the past, and scratching my head. Any thoughts?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Tue Sep 09, 2008 7:04 pm   
 
I think the problem is with the code:
Code:
#VAR smokeAfflictions.$aff 1

The #VAR command might be changing the type. With a variable key value like this, you should really be using #ADDKEY like this:
Code:
#ADDKEY smokeAfflictions $aff 1

This will also be faster since #ADDKEY (#DELKEY, etc) are properly set up to handle the hashed database variables in the most optimal way. Whereas #VAR is a very generic command and isn't necessarily as efficient.

I've also added this to the bug list. The problem seems to be with the "#VAR a.$b value" syntax. Not only does it set the @a variable to AutoType, it sometimes doesn't set the value properly either. I tested the following syntax and it seems to work:

smokeAfflictions.$aff = 1

so you can also try using that instead. But using #ADDKEY will still be the most efficient in all cases.
Reply with quote
rto0288
Beginner


Joined: 23 Apr 2006
Posts: 11

PostPosted: Wed Sep 10, 2008 3:17 am   
 
You're the man Zugg, one problem down. More to follow I'm sure :P.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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