Snippet Advent

Bribe

vJass errors are legion
Reaction score
67
Every one of your comments shows you just don't get how this works.

1. The first trigger is for storing static codes used by "register". It is attached to the event itself and this trigger can have many conditions attached to it.

2. The other triggers are dynamic, with just one condition each.

3. registerEx returns an integer which represents the registry that was just made.

4. unregister takes that integer and disassembles that registry.

The typecast of "Advent" specifically refers to the parent node that was made via the "create" method. It does not refer to the child-nodes returned by "registerEx".
 

Dirac

22710180
Reaction score
147
No Bribe i already knew the 4 points you stated. And i fully knew what your intentions were (about the first trigger being the one with many conditions and the other's having only one) And i knew this because i read the code, not because i'm trying to prove you wrong.
What you're missing is that it doesn't have to be that way.
My way you can make every "node" have many conditions if you want, the sole action of using registerEx tells the system that this registration fires at the same time the head does.
It's like a circular linked list of triggers.
However each node should be fully manipulable and it also should be removed from the list it belongs without mentioning the head whatsoever, because after all it would make no sense to register the head from itself ([ljass]call this.unregister(this)[/ljass])
The deallocate method should be like the one my linked list has, yes it forces to recycle triggers, but that doesn't cause that much damage. (IMO you should avoid loops whenever you can)
Conclusion, every node should be an Advent, apart from the nodes within it's range
Forcing the user to attach data himself makes thing only more complicate, you're doing this from the idea that every advent could have more than data attachment, and why should it?
Instead of letting the user know which Advent is the one firing this function (when there's no need at all) through the "reg" var, have every Advent store it's own "data" integer var.
 

Bribe

vJass errors are legion
Reaction score
67
I could add a regData member but what if the user wants to attach other things like units, other types, multiple variables, etc? I get that it can save arrays if the user wants it but if the user doesn't want it he must suffer an additional array (which I don't honestly think is enough of a problem for me to not do it).

Why would someone want to multi-register a dynamic sub-trigger of the Advent? I prefer keeping it as integers so the user doesn't do something screwy like firing a node instead of a proper Advent.

Recycling triggers is possible but in reality what's there to lose in destroying them and keeping the RAM/handle ID stack low? The two latter benefits (doing it my way) the user very nicely.

The Advent sharing identity with its nodes doesn't make sense. You create an Advent (say, unit indexed or unit damaged), then register some attachment functions to that Advent. You don't register attachment functions to attachment functions >>
 

Dirac

22710180
Reaction score
147
Just an [ljass]integer data[/ljass] would suffice instead of having to create lots of arrays for every time you want to attach data to advents (like the way you suggest on your documentation of having [ljass]integer AdvData[Advent.registerEx][/ljass] kind of stuff)
If you were using a circular list you could fire nodes and nothing would go wrong using this way
JASS:
local integer exit=this
loop
    call TriggerEvaluate(this)
    set this=next
    exitwhen this==exit
endloop

It wouldn't cause any issues and would provide even more flexibility (i need it for my damage library)
If you want to destroy triggers you might as well loop through the list using the loop above and then flush the list.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • jonas jonas:
    where did you go?
  • The Helper The Helper:
    Jefferson TX on a Paranormal Investigation of a haunted bed and breakfast - I got some friends that are paranormal investigators and they have an RV and do YouTubes
    +1
  • The Helper The Helper:
    It was a lot of fun. The RV was bad ass
  • jonas jonas:
    That sounds like fun!
    +1
  • The Helper The Helper:
    it was a blast!
  • The Helper The Helper:
    I am going to post the Youtube of the investigation in the forums when it is ready
    +1
  • jonas jonas:
    cool!
  • vypur85 vypur85:
    Sounds cool TH.
  • tom_mai78101 tom_mai78101:
    I was on a Legend of Zelda marathon...
  • tom_mai78101 tom_mai78101:
    Am still doing it now
    +1
  • jonas jonas:
    which one(s) are you playing?
  • jonas jonas:
    I played a little bit of the switch title two weeks ago and found it quite boring
  • The Helper The Helper:
    just got back from San Antonio this weekend had the best Buffalo Chicken Cheesesteak sandwhich in Universal City, TX - place was called Yous Guys freaking awesome! Hope everyone had a fantastic weekend!
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • The Helper The Helper:
    We have been getting crazy numbers reported by the forum of people online the bots are going crazy on us I think it is AI training bots going at it at least that is what it looks like to me.
  • The Helper The Helper:
    Most legit traffic is tracked on multiple Analytics and we have Cloud Flare setup to block a ton of stuff but still there is large amount of bots that seem to escape detection and show up in the user list of the forum. I have been watching this bullshit for a year and still cannot figure it out it is drving me crazy lol.
    +1
  • Ghan Ghan:
    Beep boop
    +1
  • The Helper The Helper:
    hears robot sounds while 250 bots are on the forum lol
  • The Helper The Helper:
    Happy Saturday!
    +1
  • The Helper The Helper:
    and then it was Thursday...
    +2
  • tom_mai78101 tom_mai78101:
    And then Monday
    +1
  • The Helper The Helper:
    I got the day off today!
    +1
  • tom_mai78101 tom_mai78101:
    How...? (T-T)
  • The Helper The Helper:
    I took the day off. I work for myself so I can do that.
    +1
  • Varine Varine:
    Well I'm already over summer

    The Helper Discord

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top