| 04-13-2009, 09:26 AM | #1 |
Is it possible to use event responses in functions called by .execute() in a way like this? JASS:scope AAA initializer init function interfaxe XXX takes nothing returns nothing function something takes nothing returns nothing call RemoveUnit(GetSpellAbilityUnit()) endfunction function somethingelse takes nothing returns nothing local XXX toexecute = something call toexecute.execute() endfunction function init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddAction(t, function somethingelse) set t = null endfunction endscope In other words, will this always remove all units casting a spell? |
| 04-13-2009, 09:48 AM | #2 |
I'm not sure whether your way would work but this definitely will: JASS:scope AAA initializer init function interfaxe XXX takes nothing returns nothing function something takes unit u returns nothing call RemoveUnit(u) endfunction function somethingelse takes nothing returns nothing local XXX toexecute = something call toexecute.execute(GetSpellAbilityUnit()) endfunction function init takes nothing returns nothing local trigger t = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_SPELL_EFFECT) endfunction endscope |
| 04-13-2009, 10:21 AM | #3 |
Actually, neither of those will work. You both forget call TriggerAddAction(t, function somethingelse) |
| 04-13-2009, 10:26 AM | #4 |
test? |
| 04-13-2009, 11:16 AM | #5 |
I have tested some event responses, and they seem to work fine. However, I don't know whether it is MUI or not. |
| 04-13-2009, 01:59 PM | #6 | |||
ReadTheFuckingManual Quote:
As for using event responses with .execute (and not .evaluate), the manual's lack of explicit mention of them for .execute() tends to tell me that it's NOT safe to start a new thread using .execute(), and then use event responses for not only a different trigger, but a different thread. (Common sense also tells me this.) In simpler terms: .evaluate() is <3, .execute() is likely </3 As well: Quote:
Quote:
|
| 04-15-2009, 01:44 AM | #7 |
you should be able to use any event response but GetTriggeringTrigger() in evaluate and execute. function pointers can be instantiated by just using the function's name, however the syntax is function interface not function interfaxe |
| 04-15-2009, 05:55 AM | #8 | |
Quote:
That was just mis-spelling. That's what happens when you are addicted to syntax highlighters. |
