• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Snippet] [Needs work] Advent

Level 17
Joined
Apr 27, 2008
Messages
2,455
I don't have the use for it, because if i need a dynamic event i would just use a dynamic trigger and don't have use of "data", but nevermind you don't have to convince me, i've just found something lame imho.
Since you are using LinkedListModule, and especially the method insertNode, which for some reason is actually reverting the relative order (i mean i don't know why Dirac has chosen this way), you would use "prev" instead of "next" in you fire method.

Because with this sample :

JASS:
scope Test initializer init

    private function F1 takes nothing returns nothing
        call BJDebugMsg("F1")
    endfunction
    
    private function F2 takes nothing returns nothing
        call BJDebugMsg("F2")
    endfunction

    private function init takes nothing returns nothing
        local Advent ev = Advent.create()
        call ev.registerEx(function F1)
        call ev.registerEx(function F2)
        call ev.fire()
    endfunction
    
endscope

The expected messages are "F1" and then "F2", not the opposite.
Ofc that probably doesn't matter that much, but i think it makes more sense this way.
 
Level 6
Joined
Jun 20, 2011
Messages
249
call ev.fire()
Here hes firing a null trigger, if you can tell why I'll give you a prize.

Yes, because of how linked list works it will always fire first the node you added last.
But Bribe made it even weirder, if you call "this.fire" the codes registered to the "this" instance are fired LAST, this I fixed in the version above
 
Last edited:
Ofc that probably doesn't matter that much, but i think it makes more sense this way.

Actually, it's very important.

Here's a theoretical example:
Let's say I register 2 codes and one of the functions I registered contains an if block that only executes the code within it if some boolean X == true.
When I execute the first function, it's sets X to true.
The second function will set X to false at the end.
If this doesn't execute code1 before code2, code2 wouldn't execute :c
 
Top