Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Emit
Magician


Joined: 24 Feb 2001
Posts: 342
Location: USA

PostPosted: 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
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: 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
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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