Updating TXP for MoP Beta
I just finally got a chance to login and start working on my experience bar addon today and after fighting with getting DC'd at 90% loaded for a few hours I got this error:
Code:
Message: Interface\AddOns\TXP\TXP.lua:58: Division by zero This is the relavant section of code: LUA Code:
And here is the entire code: LUA Code:
Any help would be awesom! Thanks guys! Edit: Just realized I threw this in the wrong section... one of you wonderful admins want to stuff this in the corner where it belongs please. |
VARIABLES_LOADED is a useless event, and is causing this problem. It fires many times during the loading process to indicate that various Blizzard or game settings are loading, and has nothing to do with addons. At that time, information about your character's experience is not yet available. Just remove that event entirely. You don't need it. You're already catching the "I'm logged in, info is now available" event with PLAYER_LOGIN, PLAYER_ENTERING_WORLD, and PLAYER_XP_UPDATE.
|
Phanx... I love you! Thanks so much, it's working perfectly in the beta for now. A little more testing and I'll upload it to the beta section.
|
1 Attachment(s)
Last night while messing around in Beta, I decided I wanted to add some additional texture options to my xp bar. I found the ones I wanted, sized them made them work and made them user selected via slash command. Now I'm stuck on how to get them to save per character. I tried it the same way that I did it for locked/unlocked visable/hidden and couldn't get it to work. I'm guessing it's because I'm not defining the variable correctly, but for the life of me I can't figure out a way to define the variable and save it. Hopefully one of you guys will see something that I don't.
Here's my code: LUA Code:
Here's my TOC: LUA Code:
and attached is the full addon just in case. |
You need to do a check like this:
lua Code:
This uses the pre-existing SVs or creates an empty table if there are none. You can also improve your slashcmdhandler like this: lua Code:
This works by doing a simple table lookup and quickly coming back with a result or nil, instead of testing each check in an if-else chain. |
Thanks Torhal. So more or less then I need to define the saved variable like this
Code:
TXPTexture = TXPTexture or {} Code:
TXPTexture = TribalExperienceBar:SetStatusBarTexture("..") |
Change your TOC so it actually saves the variable:
Code:
## SavedVariablesPerCharacter: TXPVisible, TXPLocked, TXPTexture Code:
curve = function() On a side note, if you are performing a boolean check, eg. doing one thing if X == true and another thing if Y == false, the most efficient way to do that is like this: Code:
if X then Code:
if X == true then |
Thanks Phanx. Now i have one more small(ish) problem.
I changed my TOC to: Code:
## Interface: 40300 Code:
-- Tribal Experience Bar Edit: After some more testing it seems that the texture remains set and appears after changing zones, but a /rl or logout requires me to reset the texture via slash command. |
Here - more fixups and streamlining. This separates the textures from the commands, removes duplicated code, and ensures that the param is of the same case (lower) as the table keys.
lua Code:
|
Sweet thanks Torhal! Working perfectly now on live, and I'll test it on beta tomorrow.
|
All times are GMT -6. The time now is 11:15 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI