|
Global value
#71824
04/22/06 20:30
04/22/06 20:30
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
Quick question and I must appologize for not having the time to look through the forumns but I couldn't find it in the manuel.
How do you set a global value within ALL of your code?
I will elaborate, I'm trying not to use skills but I will use them if that is how you do it, I want to be able to set a value in one piece of code, and use the include function to insert it into another piece of code and be able to manipulate and use that value with both pieces of code. How is this possible? what defines must you put in? etc.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Re: Global value
[Re: TWO]
#71826
04/22/06 22:04
04/22/06 22:04
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
I see where your going with this, isn't there any way to do it without putting it in a function? Don't get me wrong it would work just fine but it seems a bit messy to have to create and manage a function for something as simple as a single variable.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Re: Global value
[Re: TWO]
#71828
04/22/06 22:14
04/22/06 22:14
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
yes but that variable is lost when you go into a new .wdl, so if you create var super_global_var = 20; in "supercool.wdl", just because you import "supercool.wdl" in your "justfine.wdl" won't make (when you try to edit) super_global_var = 30; a valid paramter, your code will yell at you saying "what in the world is this super_global_var, tell me if i'm wrong about this, but I think that is how it works, I havn't tried this out in a while.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Re: Global value
[Re: Trooper119]
#71829
04/22/06 22:20
04/22/06 22:20
|
Joined: Jan 2006
Posts: 1,829 Neustadt, Germany
TWO
Serious User
|
Serious User
Joined: Jan 2006
Posts: 1,829
Neustadt, Germany
|
Yes *g* got a bright lamp over my head... (Sorry, in my holidays my english is turned out ->Iīm ger ) If you set, say, main.wdl in your level (Map Properties) and define there 'var somewhat;' you can use this in all scripts, if its declined _before_ the includes and other functions eg: var blabla; include <something.wdl>; If you decline a Var in, say, 'something.wdl' you can use it in something.wdl and in all fallowing scripts eg: include <render.wdl>;//Canīt use the var here in this script include <something.wdl>;//Decline the Var here include <a_car.wdl>;//and you can use it in this script And if you change it in one script, it has the same new value in all other scripts... Is that what you meant?
|
|
|
Re: Global value
[Re: TWO]
#71830
04/22/06 22:57
04/22/06 22:57
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
I think I understand, and I must say your english is great for you being German. So you are saying if I define var available; in ANY .wdl code, (such as abc.wdl) I can use the variable in abc.wdl in ANY .wdl code after that, including if you put (say abc.wdl) in your level code example: include <abc.wdl> ...your main level's code... function wowthisiscool { available = 20; //THIS WOULD WORK? } then you can put the var avariable in ANYTHING after the include? Hope that made sense. If that's right, I don't understand why I got this in my head that you couldn't?
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|