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
Palmer
Novice


Joined: 21 Mar 2003
Posts: 38
Location: USA

PostPosted: Thu Mar 27, 2003 1:36 pm   

Using variables across classes
 
is it possible to operate on variables from a class different from the current or default class, without resorting to global variables?

Edit: Sorry for the double post, my browser timed out. Please delete, administrators. =)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Mar 27, 2003 4:02 pm   
 
Yes it's possbile. Instead of using only the name of the variable, specify the full or relative path to it. Example, suppose you are currently in Class1 and the variable @test is in Class2. Both of these classes belong to the root class (0), then to access the variable you would do:
#SH @Class1/test

Other possibilities are:
#SH @../Class1/test
#SH @./Class1/test

.. referes to the parent class (the root class in this case) while . referes to the root class. You can also start a path with / to signify the current class.

Kjata
Reply with quote
Palmer
Novice


Joined: 21 Mar 2003
Posts: 38
Location: USA

PostPosted: Thu Mar 27, 2003 6:34 pm   
 
Thanks Katja! I found the relevant info in the help files, too; I've got it now.
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