+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 15 of 35

  Click here to go to the first Rift Team post in this thread.   Thread: [Request] Wild Growth Watcher

  1. #1
    Telaran Ages's Avatar
    Join Date
    Mar 2011
    Posts
    94

    Default [Request] Wild Growth Watcher

    Could someone write a small addon that would notify via chat when Wild Growth (Mage) is applied and falls off the player's target?

    Example:
    [GrowthWatcher] Wild Growth applied to Murdantix
    [GrowthWatcher] Wild Growth expiring in 5
    [GrowthWatcher] Wild Growth expiring in 4
    [GrowthWatcher] Wild Growth expiring in 3
    [GrowthWatcher] Wild Growth expiring in 2
    [GrowthWatcher] Wild Growth expiring in 1
    [GrowthWatcher] Wild Growth expired from Murdantix

    I am requesting this because as a bard when Wild Growth is applied it overwrites Coda of Jeopardy. Wild Growth lasts for about 13 seconds and its a real pain to guess when its off the target. If you re-apply jeopardy too early it wastes the combo points.

    This would be a big help.

  2. #2
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    I'm just starting out with playing around with AddOns, let me take a stab at this for you.
    Last edited by Aluzja; 11-30-2011 at 02:51 PM.

  3. #3
    Telaran
    Join Date
    Feb 2011
    Posts
    63

    Default

    You can setup an alert for that with KaruulAlert. It won't be in the chat but you can setup the icon to appear on the screen or text if you want.

  4. #4
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    I've got it working ... sorta ... I'm not 100% happy with it, as I'm just checking if the Wild Growth buff is on the target when the Event.Buff.Add event is fired, it takes a fraction of time to go through the list of buffs, check if Wild Growth is one of them, then start the countdown. So it's not completely accurate with the actual timing of the Wild Growth buff. But it displays a message every second until the buff has expired, and is off by around half a second or so.

    I still plan to mess around with it some more, just to see if I can get the timing more accurate. Let me know if you want the AddOn in it's current state.

  5. #5
    Soulwalker
    Join Date
    Mar 2011
    Posts
    6

    Default

    Still getting used to LUA myself, but Im pretty sure using Event. System.Update.Begin rather than (or even in conjunction with) Event.Buff.Add will fix your timing issue.
    Last edited by Xianth; 12-02-2011 at 04:29 PM.

  6. #6
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    Quote Originally Posted by Xianth View Post
    Still getting used to LUA myself, but Im pretty sure using Event. System.Update.Begin rather than (or even in conjunction with) Event.Buff.Add will fix your timing issue.
    Yeah I'm using it to count down the seconds, I'm pretty certain my countdown is happening at proper second intervals, the problem is getting it to start when the actual buff duration starts which so far seems hard to do, as it takes time to cycle through the list of buffs on the target, verify Wild Growth is on it, then start the 12 second duration timer.

    I've got some calculations going on that take the begin time of the buff, the current time during a Event.System.Update.Begin bound function, and using that. If I had a static # in the formula (0.2) it seems right on the money, but I have a feeling that should the AddOn be put into a bigger environment with more buffs it may get all messed up again.

  7. #7
    RIFT Fan Site Operator Aieny's Avatar
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    472

    Default

    Could you not use Inspect.Buff.Detail(unitID,buffID).remaining to set your timer?
    Last edited by Aieny; 12-03-2011 at 04:16 AM.
    a community-oriented site for all things Rift

  8. #8
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    Tried it actually, the problem I encountered was that the remaining time wouldn't be a whole # (ie 10 seconds remaining, it would be 10.75644 or the like)

    The closest I've been able to get to on time has been to do the following:

    Bind a function to Event.Buff.Add, when it finds the buff (Wild Growth), set a flag so on the next Event.System.Update.Begin function, it will start the countdown and print the seconds remaining to the chat window.

    During the Add function, I'll take store the startTime of the buff, and use that in a calculation in my Update.Begin function. I'll take the difference of the startTime and the Inspect.Time.Real() when the Update.Begin function runs, calculate the seconds that have expired and everytime one second has passed, countdown and output the seconds remaining. It was still just a hair off, so I added 0.2 to my difference calculation and it seems pretty on par for the moment. I just have a feeling it will get all wonky again when it's not just me putting on a single buff on the target.

    Thanks for the input so far everyone, it's great to have some discussion on this.

    Cheers!

  9. #9
    RIFT Fan Site Operator Aieny's Avatar
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    472

    Default

    Well, what you can do to accurately keep track of time is something similar to what I do in my WifeAggro timer. Set up a variable to keep track of the buff time (global to the Addon), storing math.floor to get the integer value of the buff time remaining. Then, check the current time remaining against the stored value remaining, and if it is less, print the message to the chat log.
    Code:
    timeRemaining = nil
    buffID = FoundBuffId()
    unitID = BuffedUnit()
    
    local function UpdateEvent()
        if buffID then
            buffTimeRemaining = Inspect.Buff.Detail(unitID, buffID).remaining
            if not timeRemaining then timeRemaining = math.floor(buffTimeRemaining) end
            
            if timeRemaining > buffTimeRemaining then
                timeRemaining = math.floor(buffTimeRemaining)
                if timeRemaining = 0 then
                    print ("Buff expired")
                    buffID = nil
                    timeRemaining = nil
                else
                    print (timeRemaining.." seconds remaining")
                end
            end
        end
    end
    a community-oriented site for all things Rift

  10. #10
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    So I fire that UpdateEvent on the Event.System.Update.Begin, wouldn't I get a spam in the chat log of the time remaining? Rather, it doesn't seem that it will only fire every whole second of duration.

    Thoughts?

    EDIT: Wait, I think I see what you're doing there now. By setting the global timeRemaining to the integer value of the buffTimeRemaining, when buffTimeRemaining is say for example 10.9 seconds, timeRemaining is 10 seconds, so as long as the updates go and buffTimeRemaining stays above 10, it won't reprint until it drops into 9.9 or so. Awesome ... I will try this code out, thanks!
    Last edited by Aluzja; 12-03-2011 at 08:02 PM.

  11. #11
    RIFT Fan Site Operator Aieny's Avatar
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    472

    Default

    Quote Originally Posted by Aluzja View Post
    By setting the global timeRemaining to the integer value of the buffTimeRemaining, when buffTimeRemaining is say for example 10.9 seconds, timeRemaining is 10 seconds, so as long as the updates go and buffTimeRemaining stays above 10, it won't reprint until it drops into 9.9 or so.
    Exactly =)
    a community-oriented site for all things Rift

  12. #12
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    Awesome, the timing is perfect!!

    Now I'm coming across another problem ... the countdown works excellent, as long as I either have my target (with the buff) selected, or on mouseover. Otherwise I get spammed an error that I'm trying to index a nil value in this line:

    buffTimeRemaining = Inspect.Buff.Detail(unitID, buffID).remaining

    I'm currently testing it with a debuff (Radiant Spores) as my mage isn't high enough to have Wild Growth. I'm thinking that should this be used with a Mage, and uses Wild Growth, the player will have the Wild Growth buff so it shouldn't give any errors ... as far as I can assume ...

  13. #13
    jca
    jca is offline
    Rift Chaser
    Join Date
    Mar 2011
    Posts
    314

    Default

    Always check the return value for nil before trying to access one of its members.

    If unitID no longer has buffID, the inspect call will return nil, therefore you get an error when you try to access nil.remaining.

    Try something more like this:
    Code:
    local detail = Inspect.Buff.Detail(unitID, buffID)
    if (detail) then
        buffTimeRemaining = detail.remaining
    else
        buffTimeRemaining = 0
    end
    Last edited by jca; 12-03-2011 at 09:16 PM.

  14. #14
    Shadowlander
    Join Date
    Sep 2010
    Posts
    32

    Default

    That's a good rule of thumb ...

    I'm curious though, why it even happens. As soon as I deselect the target I get the errors, if I reselect or hover over the target the errors go away. I still have a reference to the unitID .. it's not getting over written or set to nil anywhere ...

    EDIT: Is the unitID that is passed in to the Event.Buff.Add function only applicable if the id is in 'focus' ... either via target or hover?

    I added in your code above jca, and as soon as I deselect the target, it goes to my print statement where I say the buff has expired.
    Last edited by Aluzja; 12-03-2011 at 10:57 PM.

  15. #15
    RIFT Fan Site Operator Aieny's Avatar
    Join Date
    Feb 2011
    Location
    Earth
    Posts
    472

    Default

    Buff details are only accessible if you can access the unit by unit specifiers (a combination of player, pet, target, focus, mouseover, groupXX). This revised code should prevent spam from being unable to get buff details, but if you are buffing group members, it won't be an issue.
    Code:
    timeRemaining = nil
    buffID = FoundBuffId()
    unitID = BuffedUnit()
    
    local function UpdateEvent()
        if buffID then
            details = Inspect.Buff.Detail(unitID, buffID)
            if details then
                buffTimeRemaining = details.remaining
                if not timeRemaining then timeRemaining = math.floor(buffTimeRemaining) end
            
                if timeRemaining > buffTimeRemaining then
                    timeRemaining = math.floor(buffTimeRemaining)
                    if timeRemaining = 0 then
                        print ("Buff expired")
                        buffID = nil
                        timeRemaining = nil
                    else
                        print (timeRemaining.." seconds remaining")
                    end
                end
            end
        end
    end
    Last edited by Aieny; 12-04-2011 at 08:47 AM.
    a community-oriented site for all things Rift

+ Reply to Thread
Page 1 of 3 1 2 3 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts