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


Joined: 16 Feb 2004
Posts: 7
Location: Austria

PostPosted: Sun Mar 28, 2004 2:10 pm   

Two Question on Classes and Vars in them
 
I wrote a simple money run script and put it all in a Class MoneyRun. The Problem is, that all Vars in this Script are set outside the MoneyRun Class. How can i make them be set in the MoneyRun Class?
The secon thing is, that I need to disable the whole Class when the script is done. Any possibility to do this with a script? I just found the command to disable all triggers.

Thx
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Sun Mar 28, 2004 4:24 pm   
 
#T- MoneyRun

The variables don't need to be in the MoneyRun class. As long as you don't give them the same name as other variables, they can be in any active class (including None).
Reply with quote
Rennus
Beginner


Joined: 30 Dec 2003
Posts: 22
Location: USA

PostPosted: Sun Mar 28, 2004 4:29 pm   
 
I think what you are looking for is:
#var varname {somevalue} {%null} {MoneyRun}
The %null is a default value and the last item tells where to store the variable.
Reply with quote
Eurymedon
Newbie


Joined: 16 Feb 2004
Posts: 7
Location: Austria

PostPosted: Sun Mar 28, 2004 5:03 pm   
 
Thanks a lot!

Hmm, but the Vars are still not saved in the Class. Ok, its not really important, but it would be nice if everything is compact in the MoneyRun Class.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Mar 29, 2004 12:51 am   
 
Simply drag them into the class.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Mar 29, 2004 3:30 pm   
 
When I want to make sure that I reference variables in a specific class folder, I reference them by their full path. This is especially useful when you may have variables of the same name in different folders, which is quite possible with my scripts since I'm writing them and releasing them to the public and so they may conflict with a user's own settings if I'm not careful.

Let's say you create a variable @cash in the folder MoneyRun, you can reference it with:

MoneyRun/cash = 1234
#if (@MoneyRun/cash > 1000) {do something}

Try that and see if it helps.
Reply with quote
Eurymedon
Newbie


Joined: 16 Feb 2004
Posts: 7
Location: Austria

PostPosted: Tue Mar 30, 2004 4:57 pm   
 
Great. That works perfectly.
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