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
worlo
Newbie


Joined: 20 Jul 2004
Posts: 8

PostPosted: Thu Aug 05, 2004 12:42 pm   

Variable assignment
 
Ok I am wondering is there a problem assigning variables that are in another class without using the full path to them?

example:
#class {someclass}
#trigger {*} {amok=1}
#class {0}

#class {othersomeclass}
#var amok {}
#class {0}

If this doesn't cause problems that would mean I can move around the "othersomeclass" without affecting the brilliant "*" trigger right? Why do so many people use @othersomeclass/amok to assign variables? Is there a reason other than keeping track of where your variables are?
Reply with quote
Rorso
Wizard


Joined: 14 Oct 2000
Posts: 1368

PostPosted: Thu Aug 05, 2004 12:59 pm   Re: Variable assignment
 
worlo wrote:
Ok I am wondering is there a problem assigning variables that are in another class without using the full path to them?

example:
#class {someclass}
#trigger {*} {amok=1}
#class {0}

#class {othersomeclass}
#var amok {}
#class {0}

If this doesn't cause problems that would mean I can move around the "othersomeclass" without affecting the brilliant "*" trigger right? Why do so many people use @othersomeclass/amok to assign variables? Is there a reason other than keeping track of where your variables are?

If you use a class as "set as default when executing", and you call an alias in another class you might get strange behaviour.

Example: Class1 which is a default class calls Class2 which creates a variable containing some information needed in other classes. In this case the variable would be created in Class1 as that was the default class calling Class2. Other aliases/classes that expects the variable to be in the root of the class hierarchy won't find the data they look for.

If classes don't use "set as default when executing" you can get issues if there are duplicate variable names. Like you have "movement" defined in many different classes. Which one should be shown if you ran #show @movement? Very Happy
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