![](templates/Classic/images/spacer.gif) |
Emit Magician
Joined: 24 Feb 2001 Posts: 342 Location: USA
|
Posted: Sun Mar 10, 2002 11:07 pm
variable scope |
Whats the best way to limit the scope of a variable? i've been putting them in different classes, and using #t to switch classes on and off, but i don't know if there is a better way. also, is there anyway to refer to a variable in a particular class from the command line? any advice at all appreciated
|
|
|
![](templates/Classic/images/spacer.gif) |
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Sun Mar 10, 2002 11:28 pm |
quote:
Whats the best way to limit the scope of a variable? i've been putting them in different classes, and using #t to switch classes on and off, but i don't know if there is a better way. also, is there anyway to refer to a variable in a particular class from the command line? any advice at all appreciated
To refer to a particular variable, use the #VAR syntax and make sure to specify the class.
#VARIABLE name value default-value class
#VAR test 12 _nodef "Variables|Character"
li'l shmoe of Dragon's Gate MUD |
|
|
![](templates/Classic/images/spacer.gif) |
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon Mar 11, 2002 5:01 am |
"Best" is a personal opinion of course. The best way (in my opinion) to limit the use of a variable (I'm guessing that's what you meant) is to give all variables unique names. This seems much easier to me than making several variables with the same name but in different classes, and then trying to control which one gets used by enabling/disabling those classes. Since all my variables are therefore in the "None" class, I don't have any difficulty referring to them from the command line.
LightBulb
All scripts untested unless otherwise noted |
|
|
![](templates/Classic/images/spacer.gif) |
|
|