Thread Tools Display Modes
Prev Previous Post   Next Post Next
11-15-21, 11:26 AM   #1
Khanod
A Defias Bandit
Join Date: Nov 2021
Posts: 3
Connecting action to button

I am new to this so I am missing something likely very simple. I need to click a button which then runs through a for loop and each time the for loop executes an blizzard api. I have 7 buttons and they show up so long as I place the SetScript below all the buttons. on button press it should send the tab number to the for loop and then go through the loop until complete. It does not do anything when I press the button now.


UIConfig.GT6toBagButton = CreateFrame("Button", nil, UIConfig, "GameMenuButtonTemplate");
UIConfig.GT6toBagButton:SetPoint("CENTER", UIConfig, "TOP", 0, -190);
UIConfig.GT6toBagButton:SetSize(140, 40);
UIConfig.GT6toBagButton:SetText("GT6 to Bag");
UIConfig.GT6toBagButton:SetNormalFontObject("GameFontNormalLarge");
UIConfig.GT6toBagButton:SetHighlightFontObject("GameFontHighlightLarge");


UIConfig.GT7toBagButton = CreateFrame("Button", nil, UIConfig, "GameMenuButtonTemplate");
UIConfig.GT7toBagButton:SetPoint("CENTER", UIConfig, "TOP", 0, -220);
UIConfig.GT7toBagButton:SetSize(140, 40);
UIConfig.GT7toBagButton:SetText("GT7 to Bag");
UIConfig.GT7toBagButton:SetNormalFontObject("GameFontNormalLarge");
UIConfig.GT7toBagButton:SetHighlightFontObject("GameFontHighlightLarge");


UIConfig.GT1toBagButton:SetScript("OnClick", fromGT(self, event, 1));
UIConfig.GT2toBagButton:SetScript("OnClick", fromGT(self, event, 2));
UIConfig.GT3toBagButton:SetScript("OnClick", fromGT(self, event, 3));
UIConfig.GT4toBagButton:SetScript("OnClick", fromGT(self, event, 4));
UIConfig.GT5toBagButton:SetScript("OnClick", fromGT(self, event, 5));
UIConfig.GT6toBagButton:SetScript("OnClick", fromGT(self, event, 6));
UIConfig.GT7toBagButton:SetScript("OnClick", fromGT(self, event, 7));

local function fromGT(self, event, tabNumber)
local tab = tabNumber;

for slot = 1, 98, 1 do
AutoStoreGuildBankItem(tabNumber,slot);
end
end
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Connecting action to button


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