| 12-06-2006, 10:19 PM | #1 |
Is it possible to have some type of using command in JASS Helper such as lets say I have.. //! library PlayerState public function SetIncome takes ect. ect. .. endfunction //! endlibrary //! scope Blah using PlayerState or maybe //! using PlayerState function blah ect. call SetIncome(Player, income) call OtherFunction() //This one is not in library playerstate. endfunction //! endscope or //! using _std or //! endusing and have it interpret into this. function blah ect. call PlayerState_SetIncome(Player, income) call OtherFunction() //This one is not in library playerstate. and does not turn into PlayerState_OtherFunction() endfunction Just a suggestion, might help. |
| 12-07-2006, 01:12 AM | #2 |
Don't understand what you want. Really and use [jass] tags next time. |
| 12-07-2006, 03:41 AM | #3 |
JASS://! library PlayerState public function SetIncome takes player P, integer I returns nothing set GetPlayerObj(P).Income = I endfunction //! endlibrary //! scope Blah using PlayerState or maybe //! using PlayerState function blah takes nothing returns nothing call SetIncome(Player, income) //Will call the function from the player state library even though its not inside the library, because of the using command. call OtherFunction() //This one is not in library playerstate. endfunction //! endscope or //! using _std or //! endusing //with any of these as possibilities. basically I'm just saying to use one of these as an indicator that we are no longer using a library. Now anytime in there that I said "or" that is to indicate another possibility of how you might choose to be proper syntax for using a library. Now above I declared library PlayerState and I have a function in the library that is public, so later on in the script I may have a scope of functions that use a lot of functions in the PlayerState library, so in order to avoid typing in PlayerState_MyFunction for every function I want to use in this scope, I may want to just declare that I'm going to be using a library instead. Therefore I will declare that I'm using library PlayerState and then every function name that is Public in the library PlayerState that I use in my scope will now be converted by the preprocessor to the name PlayerState_MyFunc() even though I only typed in MyFunc().(as a possibility it would happen that is, of course I don't mean that as I have a way of doing that.) So now if I were to declare that library above and declare a scope using that library and call the function which I called, possibly it could be processed to do this. JASS:function blah takes nothing returns nothing call PlayerState_SetIncome(Player, income)//Renamed from SetIncome after the preprocessor runs. because this scope is using the library PlayerState as if it were it's own. call OtherFunction() //This one is not in library playerstate. and does not turn into PlayerState_OtherFunction() endfunction See, SetIncome Is in library PlayerState so when I call SetIncome(Player, Income) the preprocessor could change it to PlayerState_SetIncome(Player, Income) and since the function OtherFunction() is not a public function in library PlayerState it will just leave that as it is and not turn it into PlayerState_OtherFunction(). Still need clearing up? If so I'm sorry. |
| 12-07-2006, 04:10 AM | #4 |
You mean classes? PlayerState->SetIncome(Player, income); Like in php/c? |
| 12-07-2006, 08:04 AM | #5 |
I dunno, I mean more like how in C++ you have to type std:: in front of things and you can just say using std or what not instead, and then you don't need to type std:: in front of every function. But the difference being that if I define using std I would only want it to use std in front of the calls that are in the std library unlike c++ which would look for them in the std library no matter the call of the function(that may have made things more confusing, it might be better to just ignore that. especially since I don't use C++ that often and may have used incorrect terminology.) you see, you define SetIncome as a public function in the PlayerState library, but you may also have many other public functions that you would like to use in the scope from the same library. So instead of repeatedly typing PlayerState_MyFunction and then later PlayerState_ThisFunction every time you want to use them in the scope you could simply define that you will be using the PlayerState library at the beginning of the scope and then it will translate the functions as if you were still in the PlayerState library. So therefore if you use the public function SetIncome from the PlayerState library in a scope using the PlayerState library, you simply only have to type SetIncome instead of PlayerState_SetIncome to call the function. but ofcourse that does not mean putting PlayerState_ in front of every function, just the functions that are defined as public in the library of use for the scope. |
| 12-07-2006, 01:14 PM | #6 |
It is a namespace. The syntax is not good. I was going to add it eventually and replace the word scope with namespace, really, I was going to. |
| 12-08-2006, 02:57 PM | #7 |
No worries, I believe ya. |
