|
jackwest Novice
Joined: 01 Jan 2009 Posts: 35
|
Posted: Tue Feb 10, 2009 4:36 am
multiples of the same variable in the same class? |
i'll give an example
Code: |
#alias wa {#class states;sleepbit = 0;#send wake} |
and
Code: |
#alias sl {#class states;sleepbit = 1;#send sleep} |
the problem I am having is that #class states now have at least 100 copies of the variable sleepbit and it increases every time. this is also not an issue with just this one variable but basically all variables i set on a regular basis.
am i doing something wrong?
thanks,
jack |
|
|
|
Stowslee Wanderer
Joined: 20 Apr 2008 Posts: 69 Location: Watervliet, NY
|
Posted: Fri Feb 20, 2009 3:55 pm |
Not one hundred percent sure, but it looks like your alias creates that variable each time.
Personally this is how I would go about it
#alias wa {#var sleepbit 0;wake}
#alias sl {#var sleepbit 1;sleep} |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Fri Feb 20, 2009 9:12 pm |
If you want to use the #CLASS command to specifically permit multiple copies of the variable in different classes then you should restore the default when done.
Code: |
#alias wa {#class states;sleepbit = 0;#class 0;#send wake} |
It is generally better to not use the #CLASS command, and let zMud locate the correct variable for you. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
jackwest Novice
Joined: 01 Jan 2009 Posts: 35
|
Posted: Sun Feb 22, 2009 12:30 pm |
hmm. i'm using the class command because the variables where populating all over the place. so i had one of each variable in each class. so i tried to use the class command to force zmud to always act in the same class folder.
i'll manually delete all the variables and create them all in root i think, it'll be messier but probably more stable
jack |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Feb 22, 2009 5:02 pm |
Use #VARIABLE instead of #CLASS. The "class" part will only create the variable in the specified class. It may only look in that class as well, but I think the normal search rules apply to that (ie, look in the default class, then look in the root, then start looking in the folders and subfolders).
#VARIABLE name {value} {default-value or _nodef} "class"
Without the class part, the variable just gets created in whatever class (including the root) is considered the default at time of creation, which could be any of the other classes you have in your settings based on what triggers/aliases/etc have been getting executed. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|