| 05-22-2007, 11:19 AM | #1 |
I found out that BJ functions used some variables like bj_lastCreatedUnit and bj_lastCreatedEffect at first I didn't know what they were, but I realized they were treated like variables. So, are these bj vars MUI? |
| 05-22-2007, 11:20 AM | #2 |
they are global variables... nothing else... |
| 05-22-2007, 11:24 AM | #3 |
Creating a unit in a trigger, then setting a variable to Last Created Unit in another trigger does not set the variable to point to the unit created in the trigger.. Atleast, that's afaik. |
| 05-22-2007, 11:36 AM | #4 |
I don't understand, what you trying to ask ? |
| 05-22-2007, 12:31 PM | #5 |
Well let's think about this. They are normal global variables with pretty 'bj_' names. So if we set it to a variable in one function, it has that value the next time we check it. But if we set it to another value, the original value is gone. They're just normal, regular globals that are declared in every map. Good for temporary variables and stuff. |
| 05-22-2007, 12:36 PM | #6 |
But I recall UnMi saying it is MUI. :/ Well if you guys say so, then I guess it is just a global then.. Thanks for the quick replies :) |
| 05-22-2007, 12:44 PM | #7 |
BJ variables are global ones, and definitely they are not MUI. In order to understand how they are used check this example: JASS:function CountUnitsInGroup takes group g returns integer // If the user wants the group destroyed, remember that fact and clear // the flag, in case it is used again in the callback. local boolean wantDestroy = bj_wantDestroyGroup set bj_wantDestroyGroup = false set bj_groupCountUnits = 0 call ForGroup(g, function CountUnitsInGroupEnum) // If the user wants the group destroyed, do so now. if (wantDestroy) then call DestroyGroup(g) endif return bj_groupCountUnits endfunction The function CountUnitsInGroupEnum does that: JASS:function CountUnitsInGroupEnum takes nothing returns nothing set bj_groupCountUnits = bj_groupCountUnits + 1 endfunction As you can see, the variable bj_groupCountUnits is used to store data temporally and then used in other instance. Unfortunately it's not safe to store data on them for long time because they can be used by other process in your map. I hope this explanations helps you. |
