System GTrigger Event System

Discussion in 'Systems and Snippets' started by Jesus4Lyf, Mar 30, 2009.

  1. D.V.D

    D.V.D Make a wish

    Ratings:
    +73 / 0 / -0
    Hey Jesus, I have a question about this system. I noticed you have the unregister event function and I was wondering how your supposed to point it to which event to unregister as it takes nothing and returns nothing. Any help?
     
  2. Bribe

    Bribe vJass errors are legion

    Ratings:
    +67 / 0 / -0
    It loads the appropriate data from a GetTriggeringTrigger() call, so you can't just call it arbitrarily from the middle of nowhere.

    Edit: Looking at it again, those functions you mentioned just set a boolean that is similar to bj_wantDestroyGroup. Since he is firing the triggers manually, he just detects those booleans and does the appropriate actions if need be.

    JASS:
    //
                    set Trigger$NAME$NextMem=Next[Trigger$NAME$Mem]
                    if TriggerEvaluate(Trig[Trigger$NAME$Mem]) then
                        call TriggerExecute(Trig[Trigger$NAME$Mem])
                    endif
                    if UnregisterLastEvent then
                        set UnregisterLastEvent=false
                        call Unlink(Trigger$NAME$Pointer,Trigger$NAME$Mem)
                        call FreeMem(Trigger$NAME$Mem)
                    endif
                    set Trigger$NAME$Mem=Trigger$NAME$NextMem
     
  3. D.V.D

    D.V.D Make a wish

    Ratings:
    +73 / 0 / -0
    So it unregisters the event of GetTriggeringTrigger? Is there any way around that to unregister a event in a chosen trigger?
     
  4. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    A classic case of RTFM.
    JASS:
    //		   // Ability Events
    //		 - GT_UnregisterSpellEffectEvent(trigger, abilityid)      (returns the trigger passed in)
    //		 - GT_UnregisterBeginsChanellingEvent(trigger, abilityid) (returns the trigger passed in)
    //		 - GT_UnregisterBeginsCastingEvent(trigger, abilityid)    (returns the trigger passed in)
    //		 - GT_UnregisterStopsCastingEvent(trigger, abilityid)     (returns the trigger passed in)
    //		 - GT_UnregisterFinishesCastingEvent(trigger, abilityid)  (returns the trigger passed in)
    //		 - GT_UnregisterLearnsAbilityEvent(trigger, abilityid)     (returns the trigger passed in)
    //		   // Order events // (can use String2OrderIdBJ("OrderString") for orderid
    //		 - GT_UnregisterTargetOrderEvent(trigger, orderid)        (returns the trigger passed in)
    //		 - GT_UnregisterPointOrderEvent(trigger, orderid)         (returns the trigger passed in)
    //		 - GT_UnregisterNoTargetOrderEvent(trigger, orderid)      (returns the trigger passed in)
    //		   // Item events
    //		 - GT_UnregisterItemUsedEvent(trigger, itemtypeid)        (returns the trigger passed in)
    //		 - GT_UnregisterItemAcquiredEvent(trigger, itemtypeid)    (returns the trigger passed in)
    //		 - GT_UnregisterItemDroppedEvent(trigger, itemtypeid)     (returns the trigger passed in)
    //		   // Unit events
    //		 - GT_UnregisterUnitDiesEvent(trigger, unittypeid)        (returns the trigger passed in)
     
  5. D.V.D

    D.V.D Make a wish

    Ratings:
    +73 / 0 / -0
    OOOH never saw that, man i feel stupid :banghead::p Thanks Jesus( I never thought Id ever say that ) :)
     
  6. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    it's probably because his indentation is so fat in his code introductions.
     
  7. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    That's because it uses real tab characters. Which display as 8 spaces instead of 4 here. :)
     
  8. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    it looks more like 12 or so. i haven't counted, but it's higher than 8
     
  9. Bribe

    Bribe vJass errors are legion

    Ratings:
    +67 / 0 / -0
    A more than worthy reason to bump this post.

    Sankaku's anti-whitespace trolling strikes again.
     
  10. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    Oh, there was spaces and tabs in the documentation, if I recall correctly... :D

    And yea, pretty funny reason to bump post.. :p
     
  11. SanKakU

    SanKakU Member

    Ratings:
    +21 / 0 / -0
    btw, i was working on my map the other day, and was browsing through the trigger editor, and i was browsing through the systems folder and noticed that opening comment again...and counted the number of spaces. 15! so i guess that's perhaps 3 tabs and 3 spaces. or maybe 2 tabs and 7 spaces...1 tab and 11 spaces maybe...

    Anyway! just thought i'd mention that recently i've started to use SpellEvent system and i'm still using GTrigger.
    Although someone earlier was trying to compare the two...hmm...I don't think there's anything wrong with using both. What's your take on that? Initially I was doing stuff with GT and then now that I've tried using SpellEvent, it does seem to do stuff GT can't. But GT can do stuff SpellEvent can't. Or is this wrong?

    JASS:
    //*  If you specify a spell id when registering a function then
    //*  that function will only run when that ability is cast; only
    //*  one function per ability per event is supported, if you
    //*  register more functions then only the last one registered will
    //*  be called. If, however, you pass 0 as the ability id parameter
    //*  then the registered function will run for all spells. Up to
    //*  8190 functions can be registered this way for each event.
    //*  These functions will be called before the ability's specific
    //*  function in the order they were registered.
    //*

    could you do this in GT as well? if so, i didn't realize it.

    but of course, the other side of the coin is that SpellEvent doesn't have this stuff:
    JASS:
    //               - GT_UnregisterLearnsAbilityEvent(trigger, abilityid)     (returns the trigger passed in)
    //                 // Order events // (can use String2OrderIdBJ("OrderString") for orderid
    //               - GT_UnregisterTargetOrderEvent(trigger, orderid)        (returns the trigger passed in)
    //               - GT_UnregisterPointOrderEvent(trigger, orderid)         (returns the trigger passed in)
    //               - GT_UnregisterNoTargetOrderEvent(trigger, orderid)      (returns the trigger passed in)
    //                 // Item events
    //               - GT_UnregisterItemUsedEvent(trigger, itemtypeid)        (returns the trigger passed in)
    //               - GT_UnregisterItemAcquiredEvent(trigger, itemtypeid)    (returns the trigger passed in)
    //               - GT_UnregisterItemDroppedEvent(trigger, itemtypeid)     (returns the trigger passed in)
    //                 // Unit events
    //               - GT_UnregisterUnitDiesEvent(trigger, unittypeid)        (returns the trigger passed in)
     
  12. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
    When you said SpellEvent, I initially confused it for SpellStruct. :p

    GT doesn't support the passing of 0 although it could.. SpellStruct actually is a much better event system, in my opinion. To me, GT is the most lightweight thing you can use for ability events, and SpellStruct is the most endowed.

    I don't know SpellEvent intimately so I can't really comment - but use what you like! And I see no problem with using two, aside from redundancy. But if that's your flavour, by all means... :)
     
  13. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    Why don't you make it use TriggerEvaluate? Would save me a hell of a lot of time of recoding :)
     
  14. Jesus4Lyf

    Jesus4Lyf Good Idea™

    Ratings:
    +394 / 0 / -0
  15. tooltiperror

    tooltiperror Super Moderator Staff Member

    Ratings:
    +233 / 0 / -0
    Yeah, I figured out using TriggerAddCondition with the trigger it supplies, never bothered editing that post.
     

Share This Page