2 Script Questions
Hello, I would appreciate if you could help me with 2 questions.
As you can see on the screenshot the rested expbar has a bigger height than the not-rested expbar.
I use this code to decrease the height of MainMenuExpBar and I would like it to reduce the width of the rested bar too, but I cannot locate its name:
I have looked here, but there doesn't seem to be anything about the height:
I searched google for NUM_ADDONS_TO_DISPLAY and stumpled upon the code below.
It attaches AddOn memory usage to the Tracking Button.
Is there a way to make it not generate as much memory usage?
Currently when I am hovering the Tracking Button it keeps updating the usage.
My thought would be to make it only update once, which would reduce the amount of info it passes therefore less usage by itself?
Taken from https://github.com/Tuller/tullaTweak...ster/stats.lua
Any help is appreciated. Have a good day. ;)
1. In the Lua file you linked, searching for "GetXPExhaustion" -- the API function that tells you how much rested XP you have -- quickly reveals the Lua function the default UI calls to update the bar, "ExhaustionTick_OnEvent". Looking at the contents of this function, it appears that the rest bar is named named "ExhaustionLevelFillBar". Looking in the corresponding XML file reveals that "ExhaustionLevelFillBar", is actually a texture, not a statusbar, so it will have SetWidth and SetHeight methods, but not SetValue or other frame/statusbar methods.
2. I'm not sure what you mean by "make it not generate as much memory usage". The tooltip just shows you how much memory your addons are using. It doesn't "generate" any memory. If you're seeing your tooltip addon occupy increasing amounts of memory, it's probably because you're generating a new table on every update, which is very expensive and wasteful. You should only create the "topAddOns" table once, outside of the "UpdateTooltip" method. Since the number of table entries (NUM_ADDONS_TO_DISPLAY) never changes you don't even need to clear the table between uses; you can just overwrite the values like you're already doing.
Thanks for your reply Phanx :)
What I mean by "make it not generate as much memory usage" is:
The above code in 2. uses ~40kb of memory, but when I am hovering the TrackButton its memory usage raises with ~1kb/s. I believe it's doing this because the tooltip keeps updating.
Is there a way to rewrite the code so it does not update the FPS, ping, and memory all the time when hovering the TrackButton?
There are a couple issues I'm seeing. First of all, it's not a good idea to replace the metatable of a frame unless you absolutely need to. Also, you're creating an extra frame that you're not using for any specific purpose that needs a frame. Taking these issues in hand and some further optimizations, here is the code that I'd propose.
Thank you both for your reply I really appreciate it. :)
I get this error: "attempt to compare number with string" in this line: (line 71)
Phanx, I am sorry I don't understand how to do as you say :o
Could you please show me?
I tried moving the topAddOns table a couple of places outside of functions:
Once it would not show AddOn memory usage at all.
Another time the AddOn itself would start at 600kb usage and raise with 120kb/s.
I am really bad a programming, but I believe the AddOn is not creating a new table on every update; it is refilling it. What I want is just to make it not refill.
Offtopic: Do you know a good place for newbies to start learning Lua? A book, website, etc.
Again I really appreciate your help, I am sorry to be so bad at receiving it :confused:
Fixed the problem on line 62 of my posted code. I had j.Name being set there too, but removed it in favor of the addon name and ID being loaded into the table at initialization instead of on update. I had forgotten to remove GetAddOnInfo(j.ID) from the value list too.
|All times are GMT -6. The time now is 11:28 AM.|
vBulletin © 2014, Jelsoft Enterprises Ltd
©2012 ZAM Network LLC