Thread Tools Display Modes
10-15-20, 12:23 AM   #1
Kuberman
A Defias Bandit
Join Date: Oct 2020
Posts: 2
Addon that modifies ActionBars breaks in combat

I'm very new to writing addons and lua in general, and I'm not entirely sure how to word my problem properly, so please have some patience.

I'm creating an addon with the intention of flipping the right actionbar horizontally and placing it above the left most actionbar. I recycled some incomplete code I found on GitHub here: https://github.com/Industrial/idStac...ster/addon.lua

It works fine for the most part, but I've run into a strange problem. When in combat, casting certain abilities causes the altered actionbar to reset its position. Several things pop out to me. It doesn't happen when entering combat, only on certain abilities, and always consistently on those abilities. It also doesn't reset the actionbar to be vertical; it only resets the position(screenshots attached). When using the taintLog command, all I've been able to figure out is that several of the functions used are protected in combat, and so are unable to be executed. The log is also attached.

Suffice it to say I am very confused. Why is my code being executed in combat in the first place? Why does it not break immediately upon entering combat? Why do only certain abilities cause it to break?

I'm hoping for some clarity on this topic.

Thanks in advance!
Attached Thumbnails
Click image for larger version

Name:	Combat.png
Views:	293
Size:	885.3 KB
ID:	9496  Click image for larger version

Name:	NoCombat.png
Views:	260
Size:	811.3 KB
ID:	9497  
Attached Files
File Type: lua main.lua (1.9 KB, 267 views)
File Type: log taint.log (192.2 KB, 252 views)
  Reply With Quote
10-15-20, 10:32 PM   #2
Kuberman
A Defias Bandit
Join Date: Oct 2020
Posts: 2
Problem solved

I managed to solve the problem. Much of the code that I copied was needlessly complicated and very difficult for me to understand (probably due to its 2009 release date. Yikes!). I decided to bite the bullet and rewrite the code in a way that I can understand. It's far from perfect, but still more elegant than the previous solution. Here it is, if this helps anyone else.

Lua Code:
  1. local _G = _G
  2.  
  3. for i = 12, 1, -1 do
  4.     local b = _G["MultiBarLeftButton"..i]
  5.     local f = i > 1 and "MultiBarLeftButton"..i-1 or "MultiBarLeft"
  6.  
  7.     b:ClearAllPoints()
  8.     b:SetPoint("LEFT", f, "RIGHT", 6, 0)
  9. end
  10.  
  11. MultiBarLeftButton1:ClearAllPoints()
  12. MultiBarLeftButton1:SetPoint("BOTTOMLEFT", "MultiBarBottomLeftButton1", "TOPLEFT", 0, 6)
  13. StanceButton1:ClearAllPoints()
  14. StanceButton1:SetPoint("RIGHT", "MultiBarBottomLeftButton1", "TOPLEFT", -6, 4)
  Reply With Quote
11-13-20, 08:03 PM   #3
ironmoney
A Murloc Raider
Join Date: Apr 2010
Posts: 4
just wanted to say thanks. very cool!
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Addon that modifies ActionBars breaks in combat

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off