| 08-03-2003, 12:40 AM | #1 |
just a small question, when you use the triggeraddaction function and for the action you add a function with a variable parameter, will it define that value then or when the action is done? (btw, its psuedocode... im away from computers for two weeks and can't write too well) example: set ugd_integerA = 2 TriggerAddActions(trig1, randomFunction(IntegerA)) set ugd_integerA = 4 run trig1 now if trig1 divided the paramater by 2 would the result be 1 or 2? (basically what i am asking is if it will read the value of integer A when i first initialized the action or when the trigger is run) |
| 08-03-2003, 01:38 AM | #2 |
no return functions for trigs i believe |
| 08-03-2003, 02:01 AM | #3 |
sorry i meant if the function is: function randomFuction takes integer A returns nothing set ugd_outcome = A / 2 //<== what would Outcome equal? |
| 08-03-2003, 03:03 AM | #4 |
no it was my mistake. it's not return functions, it's variable parameters. i don't think triggeraddaction can take a function with a variable parameter. i've tried and haven't gotten it to work yet. i may have just made a mistake. interesting question though. well if u were using a global variable, instead of a parameter, it would depend on the value of int a when u call the trigger, not so much on when u declare it. so if ur war3map.j looked like this (pseudocode also): global real IntA = 4 trigger Booba function IntAFunction takes nothing returns nothing set IntA = IntA / 2 endfunction function IntAexecution takes nothing returns nothing call ExecuteBooba@MapInit() call TriggerAddAction(Booba, IntAFunction) endfunction function Main takes nothing returns nothing set IntA = 6 call IntAexecution() endfunction if this were the case u would IntA == 3 i believe. however if u created another trig that would fire at the same time, that changed IntA to 4, then IntA would = 2. It's not so much reliant on where TriggerAddAction is on your code, but more so on the value of IntA when the trigger actually fires. I think that's right. |
