+ Reply to Thread
Results 1 to 5 of 5

Thread: Random error

  1. #1
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default Random error

    Code:
    x1:SetText(Inspect.Pvp.Prestige().rank.." ")
    x2:SetText(Inspect.Pvp.Prestige().accumulated.."/"..Inspect.Pvp.Prestige().needed)
    This gives an error after every zone change, can't figure out why it happens since it still works

    It loops on Event.System.Update.Begin

    Any one able to help me out with this so I can release my addon?

    Error: ezPvP/main.lua:298: attempt to index a nil value
    In ezPvP / Set Statistics, event Event.System.Update.Begin
    stack traceback:
    ezPvP/main.lua:298: in function <ezPvP/main.lua:241>
    What i've noticed is that only on first 10 or so fires from the system loop is when the error occurs, afterwards its fine and this happening does not impact functionality in anyway it's just irritating and a deterrent from my would-be users so all help would be GREAT
    Last edited by Zanderfied; 06-05-2014 at 05:32 AM.

  2. #2
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    I'd imagine the nil value is the result of the call to Inspect.Pvp.Prestige(). This is probably because you're calling it as the game is starting up, before all of the player's data is available.

    There are ways to wait until the player is fully loaded (lots of addons do this), but it's generally a bad idea to call inspectors any more than absolutely necessary, so an easy solution in this case could be:

    Code:
    local prestige = Inspect.Pvp.Prestige()
    if (prestige) then
      x1:SetText(prestige.rank.." ")
      x2:SetText(prestige.accumulated.."/"..prestige.needed)
    end
    No guarantees this will actually work, but there's a good chance it will

    - Wild

    Gadgets: Unit Frames and Other Stuff for RIFT

  3. #3
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default

    Thank you very much for your response, I was under the same belief.

    The only issues with laying the inspector outside of the loop is that it wont update immediately when the client ranks up in prestige.

  4. #4
    Sword of Telara DoomSprout's Avatar
    Join Date
    Apr 2011
    Posts
    876

    Default

    Quote Originally Posted by Zanderfied View Post
    Thank you very much for your response, I was under the same belief.

    The only issues with laying the inspector outside of the loop is that it wont update immediately when the client ranks up in prestige.
    That doesn't need to be outside of the loop - you could either include that in the loop, or if there is more processing being done, simply put...

    Code:
    local prestige = Inspect.Pvp.Prestige()
    if not prestige then return end
    ...at the start of the loop.

    The "proper" way to do it, reducing your CPU load, would be to respond to the events:

    Event.Pvp.Prestige.Accumulated
    Event.Pvp.Prestige.Rank

    That way, you're only inspecting and updating your UI when a change actually occurs.

    Gadgets: Unit Frames and Other Stuff for RIFT

  5. #5
    Shadowlander Zanderfied's Avatar
    Join Date
    Apr 2014
    Posts
    31

    Default

    Thank you, that is the exact sort of insight i've been looking for.

    Could you please take a moment to look at my other post if you have the time

+ Reply to Thread

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