currency display issues
Hello folks,
as seen here i have set up a currency display on my orderhallbar. So i wanted to step up the game and update the currencies with Code:
hooksecurefunc("TokenFrame_Update", getCurrencies) Code:
local function updateCurrencies() Thanks in advance WoWI community. |
In my addon that does something similar I used :Hide() before making the object visible.
Minor fix: after Lua Code:
Lua Code:
|
Quote:
Code:
if prevName == nil then Bearing in mind flexibility as not every char/user would want to use the exact same currencies i use, there's my dilemma, therefore i used prevName as a variable to use currency[prevName]. i tried polluting a table and using a counter variable, so i could have used (e.g) slots[i], but that brought other issues. Like i said i tried much working around this so i could effectively use a flexible system that displays the isWatched currencies (up to 3 as limited per defaultUI). it's very likely just a structural problem with my code, as it does kinda work. before i had it hardcoded in, later on used saved vars where i could add an item to the list, but it always required an uireload. And that's what i want to prevent here :) edit: just had an idea pop up. As the Default UI dictates 3 or less currencies i could create the frames beforehand and use :Hide() and :Show() as you've mentioned before. I'll try that now, thanks! |
I suggested something like this
Lua Code:
For me it feels like Lua Code:
I think Lua Code:
|
Quote:
Anyways, i misliked the prevName variable anyways, and tried a different aproach (altough i now again have to use a counter variable). it's almost working (at least if i watched 3 currencies, removed one, and added one back), but still bugs out if i remove two currencies. It's more or less tzhe same anyways, but i feel this is a bit of an better aproach as it only crates 3 textures/frames/fontstrings and reuses them. Code:
local currency = {} Done! Works flawless now as far as my 30 sec test goes :) Thank you again! here is the commit for future references. |
Glad that I was able to be of assistance.
The logic still feels wrong. Separating creation and visibility of objects is a good start. Don't see the reason why Lua Code:
Lua Code:
Lua Code:
Lua Code:
|
True. I was hurrying yesterday and didn't "clean up".
|
All times are GMT -6. The time now is 11:43 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI