| 01-26-2008, 05:01 PM | #1 |
Hi ho I think this question is quite obvious, and probably asked several times before. But is it possible, when you set up an enumeration, say ForForce, to pass a local variable to the callback function? JASS:native ForForce takes force whichForce, code callback returns nothing I'm afraid I already know the answer to this question, but I've still got a spark of hope somewhere very deep in my obscure caverns of desperation that a messiah will come to enlighten me. Thanks in advance |
| 01-26-2008, 05:18 PM | #2 |
Use a global to transfer the local variable. |
| 01-26-2008, 07:08 PM | #3 |
Hooray, wasting a complete global for one time I want to initialize a trigger... I know how to do it without passing, and I even don't really have to use a callback function, I can just make it a loop, but it's just nicer with a nice ForForce enumeration. Isn't there any way to pass a local variable to another function in callback form? |
| 01-27-2008, 09:28 AM | #4 |
No use a global |
| 01-27-2008, 02:22 PM | #6 |
ForGroup() enumeration does not permit passing locals. You don't have to 'waste a global' or even declare a new one. I always use one of the random BJ globals built into every WC3 map. If you need to pass a unit, use bj_ghoul[1] or something. Just open up the BJ and check it out, there's a whole list. |
| 01-27-2008, 06:23 PM | #7 |
Hehe good idea. But it's a trigger I want to pass, and I don't see any trigger variables or arrays in the globals list of BJ that are healthy to mess with. Anyway, I'll just use the default global trigger that's created but not used because I use scopes and local triggers. I'll take your idea in mind for next time. :) Thanks for all the replies. (+ rep for the only person that actually gave an answer longer than one phrase) |
| 01-27-2008, 06:59 PM | #8 |
I suggest to use this BJ variable: bj_destInRegionDiesTrig |
| 01-27-2008, 09:19 PM | #9 |
Just make the global. Or how about stopping to use ForGroup? I doubt there is any legit use for it. |
| 01-28-2008, 12:13 AM | #10 |
If you really don't want to declare a global, then create a trigger-page called Trig and you will now have access to the variable: gg_trg_Trig |
| 01-28-2008, 11:01 AM | #11 | |
Quote:
A ForGroup is faster than create an other group and remove/add the units, no ? (if you don't need to filter the units in this group) |
| 01-28-2008, 06:30 PM | #12 | ||
Quote:
Quote:
As you can read in my previous post, this topic is answered already. |
| 01-28-2008, 07:53 PM | #13 | ||
Quote:
Quote:
JASS:local integer i=0 loop exitwhen i>=16 if (PlayerInForceWhateverThisNativeIsCalled( Player(i) , myForce) ) then //do something. endif set i=i+1 endloop |
| 01-28-2008, 08:24 PM | #14 |
You could also just have a global boolean array, set it to true if they're playing, false if not, then check that. |
| 01-28-2008, 08:26 PM | #15 | |
Quote:
You've got a point there. I'll just use that in the future. I actually even shouldn't be using a force. If I'm using a force that's just being initialized at the beginning of the map, as I am now, I could just do: JASS:local integer i=0 loop exitwhen i>=16 if (ConditionsForBeingInForceApply(Player(i))) then // do something endif set i = i + 1 endloop Which wouldn't even need a force global. Whatever, I'm just going to keep it as I have it now, and change it later. I've not been developing my map very attentively the last few days, mainly because of my exams, which actually only lets me reply to some topics on the forum, and nothing more. :p Alright, topic answered, thanks for all the replies. :) |
