|
Eurymedon Newbie
Joined: 16 Feb 2004 Posts: 7 Location: Austria
|
Posted: 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 |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: 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). |
|
|
|
Rennus Beginner
Joined: 30 Dec 2003 Posts: 22 Location: USA
|
Posted: 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. |
|
|
|
Eurymedon Newbie
Joined: 16 Feb 2004 Posts: 7 Location: Austria
|
Posted: 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. |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Mar 29, 2004 12:51 am |
Simply drag them into the class.
|
|
|
|
Larkin Wizard
Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: 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. |
|
|
|
Eurymedon Newbie
Joined: 16 Feb 2004 Posts: 7 Location: Austria
|
Posted: Tue Mar 30, 2004 4:57 pm |
Great. That works perfectly.
|
|
|
|
|
|