WeakAuras

Triggers for pet info

  • 12 posts
    #1 Feb 26, 2011 at 10:21 UTC - 1 like

    I've been messing with triggers for displaying a progress texture for when my pets health is <50% ...which worked perfect. But I had to make a custom trigger to show when I have an active pet (in this case my Unholy ghoul) and came up with a custom event trigger...

    Event Type: Status

    Events: UNIT_PET

    Trigger:

    function()
      local NoPet
      if UnitExists("pet") == nil then
        NoPet = true
      end
      return NoPet
    end
    

    Untrigger:

    function()
      local NoPet
      if UnitExists("pet") == nil then
        NoPet = true
      end
      return not NoPet
    end
    

    I tested this a few times, and the game does fire UNIT_PET after speccing out of and back into Unholy so the texture is displayed after changing your spec as well (as apposed to only after losing your pet).

    I figure this might be a common enough desire to warrant adding in a trigger for it, I know at least one guildy wanted to know if I got this to work.

    Heres my export (its set up to only load for Unholy DK atm, but if changed should work for any pet spec)

    duKmhaGiuOgfkOtHI0TGKDbummk6yqSmQQNrLMgkDnLQTreFdiJJOCoIQ5bPs3tLQ9bPIdQuOfsKEikKjcPKlIIAJsfFefyKqQ6KkLALQuEjqPmtGs1ov0pPKmukXrHuWsHuQNkzQu4QkfSvueRfOKMRsr7v8xvYGvLdRWIPcpgKjdOlJSzPQplvA0uLtRQETsjZgu3gGDJQFty4uQLd1ZvY0jDDvSDkPgpv05bQwpKI2VuouqjEyKcDqIrkaPaMcymsDwe(c8mntDwe(YzMMPCAvF)I00bfiewexF5iY3zLjH10m9OyLNcCR67xKMo7MU(7Y9LZ6dcKRVCqPhflBQ1aazqo1dMI0uyHouYGCQPMwnzoLJb0wDXIdhiJeWcCmYejDKycANLL130froizSsspQ99m9Z0mt30HD3hXxIPmtFxqYbj3p9OKyMjBMMGzpAkf)72LWXi1H)1u2KMc6SubGlfCBk1sh6zLsb3MsbDwQaqQZIU8ObS6fhPoCYAIRPGolvaif0zPcaP6pCi9l4mKPTBTx7blGgWT3uyH02T2R9(9T3g4FLzN)LUyiJTjLXmT9UFV94F42t9iE7w71ETx7nfwiT9U3Ek(qTBTx7rCGTBTx7Hj9G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6DjSj8qf4uOZ9uE0aw9sbYmAQp3AcVO4iLa)jUo0VGNc9wH2BdwTAASrWEkiSW(YzMMGHfjL(bq4inLsovgjGf4yKjsMiz6NjsMUzIKjBMirJMALcbmUGXpL1zI4A6hnba
    
    Last edited Feb 26, 2011 by vbaspcppguy
    #2 Feb 26, 2011 at 10:50 UTC - 0 likes

    Quite odd that you post this mere minutes after I post this! They are almost identical except that your trigger checks if a pet exists as opposed to when one doesn't exist, and your code is a little unnecessarily verbose (not UnitExists("pet") performs approximately the same function as UnitExists("pet") == nil, and the local variable can be eliminated completely by just moving the conditional expression to the return statement). Nevertheless, I love seeing users explore the possibilities of Custom Triggers, as they are a powerful and flexible feature indeed.

    Quote from vbaspcppguy:

    I figure this might be a common enough desire to warrant adding in a trigger for it

    Default functionality for this will be included in 1.4; specifically, there will be a new Unit Characteristics (or "Unit Status" or just "Unit"; I haven't exactly decided on a name yet) trigger that will include many generic unit options. Among these will be an option to simply check if a unit exists (or doesn't).

    Last edited Feb 26, 2011 by Mirrormn
    #3 Feb 26, 2011 at 22:47 UTC - 0 likes

    Heh, yeah, I spent a couple hours trying to figure out how to make it all work. I'm not that familiar with the WoW API let alone LUA (doesn't help that I really only use C type languages)... when I got this to work I was done lol. I've learned more little LUA tricks in my few days of using WeakAuras (ie PossiblyNilValue or 0) than I have in all my fiddling with addons in the past.

    #4 Apr 21, 2013 at 13:31 UTC - 0 likes

    Find that string working fine for me except for one thing: it is not untriggered when in midair on flying mount and when dead. Can that be solved?

    Last edited Apr 21, 2013 by _dysphoria
    #5 Apr 21, 2013 at 18:10 UTC - 0 likes

    Try adding PET_BAR_HIDE and PLAYER_ENTERING_WORLD to your list of events.

    #6 Apr 21, 2013 at 18:45 UTC - 0 likes

    Do I have to create new triggers for it? In that case it doesn't help.

    #7 Apr 22, 2013 at 11:05 UTC - 0 likes

    In Events change

    UNIT_PET

    to

    UNIT_PET PET_BAR_HIDE PLAYER_ENTERING_WORLD

    Last edited Jun 27, 2013 by machinelf
    #8 Apr 22, 2013 at 12:15 UTC - 0 likes

    @machinelf: Go

    Didn't help. Still shows up when dead and on flying mount.

    Last edited Apr 22, 2013 by _dysphoria
    #9 Apr 22, 2013 at 12:49 UTC - 0 likes

    Post the export string then. I can't see any reason why that wouldn't work unless there is a typo or something.

    #10 Apr 22, 2013 at 13:17 UTC - 0 likes

    There:

    dK02haGiuLmkufofQIUfL0Uesnmr5yq1YOuptPmnqDnuzBKOVjuJdsohLyEOuP7bs2hkv5GGuluiEiqvtevPUOQkBuvXhbQmsifNKeSsvv9siLyMQkPBIsvTtv5NOQAOIkhfsPAPQk1tvmvuCvvLyROuQVIsfNfLcwlKsAUqQ2R0FvQgSGdlYIbkpgktgixMyZQWNrjJMKonGxlKmBiUni2nP(nfdxfTCKEUsMovxxL2oj03rPOXlQ68OQSEukz)iEyKs5qPuOlEz6aPdOoGktN7sO781xwN7sO757lRdMbXqltF29dQyByL2zWCWCwST546HvUT(26huWW2zW4k5GHH34Wr1dRCB9b3pOGvQmwz8goo3MsCBu9Wk3w9oxTtbyXsOLPZDj7QscXvlyDuLeIRUBofAYn0oShuDofkMODvjH4QDIZ6CxY(vd4nshS7Ynq6CC1yoGrZdEs(tcKaIblHqcptoXj)jbsa4Ge(IgW)Lhy5lEWRtX5fpjbOGIe0aiKGRkAYFsGeibs4zYjojafj40Rq(tcKGObr(tcKav8lvtcAJtcptoXj)fnOoxnG35u8o3LSFkumr7QscXvBKoNcft0UQKqC1DZPqtUH2H9GQJQKqC1oXz17SsqegjVFPsJ0HA8KlmsEVZJ)3VojnaKKdy0LPdKeGUmDoPYs8oNxKLuVEhNcWILqlthS7Ynq2vbajDCaicOoxnG35u8ooFNshS7Ynq6CxYUQKqC1cwNRwuu0EhS7Ynq6GDxUbsNJRgZbmAEWtYFsGeibsaXGLqiHNjN4K)KajqcKaWbj8fnG)lpWYx8GxNIZlEscqbfjObqibxv0K)KajqcKajqcKaj8m5eNeGIeC6vi)jbsGeibrdI8NeibsGeOIFPAs4z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LdrfsxDaUPWgeB2WbSYawAx)4y2IBzHkpH8eYRmpH8MZtip08eIhpDnTWHOhUE4K0fKNa6Ys8ea
    
    #12 Apr 23, 2013 at 06:28 UTC - 0 likes

    Okay, I see where I made a mistake :) Thank you, that works perfectly!

    Last edited Apr 23, 2013 by _dysphoria
  • 12 posts

You must login to post a comment. Don't have an account? Register to get one!