Creating Secure Action Buttons + Keybinding them - WoWInterface
Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-26-19, 06:49 PM   #1
A Deviate Faerie Dragon
Join Date: Apr 2018
Posts: 13
Creating Secure Action Buttons + Keybinding them

Hi, I am a noob at scripting and I'm struggling to create a secure action button so I can use something along the lines of UseContainerItem or UseItemByName. I also would like to use this button via a Keybind in the Key Bindings options.

I got some code which I tried to use on my keybind resulting in a popup saying that I'm trying to use a protected function:

function UseItem()
local a
local b
local s = 0
    while s <= 4 do
    local c = 1
    local n = GetContainerNumSlots(s)
	    while c <= n and n > 0 do
	    local r = GetContainerItemLink(s, c)             						
		if r then 
			local x = string.find(r, "%[") +1;
                        local y = string.find(r, "%]") -1;
                        local z = string.sub(r, x, y)
                        if useitemtable[z] then a = nil UseContainerItem(s, c) c = n s = 5
		        elseif questitemtable[z] then
				if not a then a = s b = c
            c = c + 1
    s = s + 1
if a then UseContainerItem(a, b)
I think this will just use the first item it finds in the inventory that is in the set called useitemtable, if there is none it will use questitemtable. I just don't really understand how the button frame works at all, I think I have to use "item" type and the ["bag", "slot"] attribute in the button frame, but I have no idea how to actually use the button with a keybind or how exactly the button frame would look. I know I could just do a macro with /use, but there are roughly 20-30 items on each list so that just won't fit.

Last edited by CrittenxD : 05-26-19 at 08:34 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Creating Secure Action Buttons + Keybinding them

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