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
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Tue Aug 16, 2011 12:36 am   

Variable hijacking! (CMUD v3.34)
 
During normal script execution, some variables occasionally reproduce themselves in classes other than expected and take over functionality. Most of my variables are defined within scripts using the "var=value" syntax. I only use the "#VAR var value classname" syntax when the variable name uses %concat or other wierdness, and in those cases (all two of them) I do specify the class. None of my scripts use the #CLASS command internally. (The Package Editor's search feature doesn't give anything when I type in "#CLASS")

In an extreme case, one script occasionally creates a class whose name is the script text! By occasionally, I mean it has done so three times, and said script fires every .4 seconds when active - several thousand times in one session.

My question is, is there any way to force CMUD to use an existing variables instead of creating new ones by the same name? Or perhaps point out other things that might be causing this to happen so I can correct my scripts?
_________________
.geniusclown
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Tue Aug 16, 2011 3:13 am   
 
Use the explicit-path syntax for all variable references. Instead of this:

varname = value

you would use this:

//module/class/.../varname = value

This prevents CMud from using its internal logic to find variables--unless you mistakenly disabled the window, module, or class it was contained in.
_________________
EDIT: I didn't like my old signature
Reply with quote
geniusclown
Magician


Joined: 23 Apr 2003
Posts: 358
Location: USA

PostPosted: Tue Aug 16, 2011 4:26 am   
 
That's what I was looking for. Thanks!
_________________
.geniusclown
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