|
geniusclown Magician
Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: 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 |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: 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 |
|
|
|
geniusclown Magician
Joined: 23 Apr 2003 Posts: 358 Location: USA
|
Posted: Tue Aug 16, 2011 4:26 am |
That's what I was looking for. Thanks!
|
|
_________________ .geniusclown |
|
|
|
|
|