View Single Post
12-05-22, 07:45 PM   #2
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
First of all, I honestly don't see a problem with the video. The bar between the groups matched the longest group the entire time. Do you have a better example video?

Secondly, there's a logic issue with your code. Let's go through some scenarios.
Scenario 1: top larger, stays the largest one each run
Result: code will hook top SetWidth each time it runs, eventually resulting in lag each SetWidth call that gets worse (setWidthHook gets spammed)

Scenario 2: top larger, then bottom larger, then top larger
Result: code hooks SetWidth on top, then hooks bottom SetWidth, then never runs again. Both SetWidths call setWidthHook, giving the top width then the bottom width. Because of hook order, only the bottom width is used because it was last.

Scenario 3: bottom larger
Result: like #2, but it doesn't matter what happens after, the code will only run once and only be hooked to bottom.
Hooks are immutable. You can't get rid of them unless you overwrite the hooked function (or reload/relog). They also stack theoretically infinitely to the point where the game would just freeze when the hooked function is called. You should only ever hook a specific function once, find some way to switch things inside the function object you put on the hook while hooking both elsewhere first.

Also, sorry to potentially confuse you further, but you should try to avoid hooking or otherwise permanently messing with a weakaura's region. Weakauras pools its frames, and in some clone situations there's a chance a hooked region may be reused by another clone or even another weakaura. I don't think this particular hook/region will have any issues, just parroting the drivel the WA devs tell people. I suggest using WeakAuras.ScanEvents to communicate between the resource bar and the other bars.
  Reply With Quote