About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Tue Dec 01, 2009 5:44 pm   

[3.12] Seems like %db sometimes lose results
 
Hi.
From my observation I can say, that from time to time %db sometimes lose some records.
I found that using my team members kill coutner.

Code:


#VARIABLE killsTeam %null
#VARIABLE teamMianownik name1|name2|name

#TRIGGER {^(?:> )?(@teamMianownik) kills (.+)\.$} {
   $count = %db(@killsTeam, %1)
   #ADDKEY killsTeam {%1} {%eval($count+1)}
   #SAYADD %ansi(15)" [ "%ansi(10)%eval($count+1)%ansi(15)" ]"
} Scripts regex$


It is very rare (found this 3rd time) but it occurs, that after having in variable killsTeam for exmaple name1=121 suddenly, after another kill, name1=%null, so another kill makes name1=1.
Other fields like name2 and name3 are still good.

Any idea Zugg? Looks like %db can sometimes get corrupted result.

Best regards
Yodous
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: Tue Dec 01, 2009 6:09 pm   
 
Are you using multiple windows? When I do so, and I mark another windows, e.g. scroll in a capture window, all variables being modified (or aliases) end up attached in that window. It may also be so that while you have marked that window, and any variable is being accessed, CMUD tries to read that variable from the window you have currently marked. Meaning that if you don't have the variable in the marked window, you'll end up with a %null, and somehow the original variable (at the correct location) overwritten. I posted about this in the thread: http://forums.zuggsoft.com/forums/viewtopic.php?t=34195

//DanteX
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Tue Dec 01, 2009 8:44 pm   
 
No. I don't use multiple windows.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Tue Dec 01, 2009 9:41 pm   
 
Make sure there aren't any other triggers making changes to @killsTeam. Also, make sure that @teamMianownik does not contain any blank values, e.g. any cases of "||" or a "|" at the beginning or end of the list.

I've never seen %db lose a value on its own, so I suspect there is something in your code doing it.
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: Tue Dec 01, 2009 9:48 pm   
 
There isn't any way in my scripts to corrupt @teamMianownik since the variable is setted only once, when I check my team. And there isn't any blank values. I made some precautions to prevent this and I check the values of this variable.
It realy looks like sometimes %db is returning a null value. And as I said - I saw this only a few times (about 3)
Reply with quote
DanteX
Apprentice


Joined: 13 Aug 2007
Posts: 166

PostPosted: Wed Dec 02, 2009 10:21 am   
 
Do you have cripts that perform class toggling? For me it also occured that when I often toggled classes, variables got stored there... so I had to rewrite those scripts. Done a search for that variable to see if you have ended up wih more than one copy of it?
Reply with quote
Zugg
MASTER


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

PostPosted: Wed Dec 02, 2009 4:56 pm   
 
You will need to show us the value of your @killsTeam variable when it screws up like this. I cannot reproduce any problem with the code you posted above. It works fine for me here.

It really sounds like your @killsTeam variable is getting modified somewhere else. Or maybe your trigger is firing sometimes with a bad value for %1.

Btw, you should try to eliminate the use of %eval when possible to speed up your scripts. I would rewrite your script like this:
Code:
#VARIABLE killsTeam %null
#VARIABLE teamMianownik {name1|name2|name}

#TRIGGER {^(?:> )?(@teamMianownik) kills (.+)\.$} {
   $count = %db(@killsTeam, %1)
   $newcount = ($count+1)
   #ADDKEY killsTeam %1 $newcount
   #SAYADD %ansi(15)" [ "%ansi(10)$newcount%ansi(15)" ]"
} Scripts regex

Note that just using () around an expression will cause it to be evaluated instead of calling %eval. That allows the compiler to compile the expression instead of calling the compiler at runtime with %eval. Also, note the {} around the initial string list to allow you to have spaces in the names, and notice that you don't need {} around the %1 in the $ADDKEY call (that's a syntax left over from zMUD). Note sure what the $ at the end of the script after "regex" was for, but it shouldn't be there.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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