Thread Tools Display Modes
03-15-14, 01:05 AM   #1
Exinium
A Kobold Labourer
Join Date: Mar 2014
Posts: 1
Clickthrough Addon Help

I'm a total addon noob. With that in mind, I think I know what's going on. Well, I should anyway. The post I obtained the addon from is from 2008, and as such, I have no clue what the changes to addons since then were.

Basically, I need to click through a single action bar. I was able to use /framestack to obtain the frame names of each individual button. I'd like to be able to toggle it on and off using the /clickthrough command. Here's what I've got.


Code:
local _G = getfenv(0)
local framelist = {
  "ElvUI_Bar6Button1"
  "ElvUI_Bar6Button2"
  "ElvUI_Bar6Button3"
  "ElvUI_Bar6Button4"
  "ElvUI_Bar6Button5"
  }

local clickable = false

SlashCmdList["CLICKTHROUGH"] = function()
  for _, v in ipairs(framelist) do
   _G[v]:EnableMouse(clickable)
  end
  if clickable then
   clickable = false
  else
   clickable = true
  end
end
   
SLASH_CLICKTHROUGH1 = '/clickthrough'
I don't think the issue lies in the .toc file, so I won't post that.

The problem is with the /clickthrough I think.

Edit:

Code:
/run ElvUI_Bar6Button1:EnableMouse(0)
/run ElvUI_Bar6Button2:EnableMouse(0)
/run ElvUI_Bar6Button3:EnableMouse(0)
/run ElvUI_Bar6Button4:EnableMouse(0)
/run ElvUI_Bar6Button5:EnableMouse(0)
Making a macro like that works. (I know that can be made into an array/for loop, but I didn't want the opportunity to **** that up.)

Last edited by Exinium : 03-15-14 at 02:26 AM.
  Reply With Quote
03-15-14, 07:30 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Whenever you're working with addon code, you should always have some kind of error display enabled, such as BugSack. The game's default error display (Interface Options > Help > Display Lua errors) is not good enough, as it cannot show you errors that occur during the initial loading process -- like the ones in the code you posted. Your table syntax was incorrect; values must be separated by commas.

Code:
local frames = {
	"ElvUI_Bar6Button1",
	"ElvUI_Bar6Button2",
	"ElvUI_Bar6Button3",
	"ElvUI_Bar6Button4",
	"ElvUI_Bar6Button5"
}

local clickable = true

SLASH_CLICKTHROUGH1 = "/clickthrough"
SlashCmdList["CLICKTHROUGH"] = function()
	clickable = not clickable
	for i = 1, #frames do
		_G[frames[i]]:EnableMouse(clickable)
	end
	print("Frames are now", clickable and "clickable." or "not clickable.")
end
I also simplified some other things for you (you don't need a whole if/else check to toggle a boolean, and you don't need to use getfenv to access _G, and a simple i = 1, #tbl loop is much faster than ipairs(tbl) which really doesn't need to exist at all) and added a notification message.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
03-15-14, 10:11 PM   #3
semlar
A Pyroguard Emberseer
 
semlar's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2007
Posts: 1,060
No point in even having a table if those are the frame names, you could just do this..
Lua Code:
  1. local clickable = true
  2. SLASH_CLICKTHROUGH1 = '/clickthrough'
  3. SlashCmdList.CLICKTHROUGH = function()
  4.     clickable = not clickable
  5.     for i = 1, 5 do
  6.         _G['ElvUI_Bar6Button' .. i]:EnableMouse(clickable)
  7.     end
  8.     print('Frames are now', clickable and 'clickable.' or 'not clickable.')
  9. end
  Reply With Quote
03-15-14, 10:38 PM   #4
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Originally Posted by semlar View Post
No point in even having a table if those are the frame names, you could just do this..
chch

Touché ;D
  Reply With Quote
03-15-14, 10:44 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
True, and I considered that, but I figured it was better to leave the table so other frames could easily be added in the future.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Clickthrough Addon Help


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