WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   New to lua, need help implementing a loop. (https://www.wowinterface.com/forums/showthread.php?t=57128)

Maulkin 05-02-19 04:38 PM

New to lua, need help implementing a loop.
 
Hello All,

This is my current code:
Code:

local DefensiveStance = 71
local RighteousFury = 25780
local ShieldBlock = 2565
local Taunt = 355

local button = CreateFrame("Button", "ReRoll", UIParent, "ActionButtonTemplate, InsecureActionButtonTemplate")
local type = "item"
local id = 777992
--local name, icon = GetItemInfo(id)
local name, _, _, _, _, _, _, _, _, icon = GetItemInfo(id)
button:SetAttribute("type", "item")
button:SetAttribute("*item1", name)
button:SetAttribute("itemid", id)
button:SetText(name)
button.icon:SetTexture(icon)
button:SetAttribute("checkselfcast","1")
button:SetAttribute("checkfocuscast","1")
button:SetAttribute("enabled", true)
button:SetPoint("TOP", 0, -150)
button:SetSize(32, 32)
StaticPopup1Button1:Click()

local frame = CreateFrame('Frame')
frame:SetScript('OnEvent', function(self, event, ...)
    frame[event](self, ...)
end
 
function frame:LEARNED_SPELL_IN_TAB(self, ...)
    if IsSpellKnown(DefensiveStance, false) and IsSpellKnown(RighteousFury, false) and IsSpellKnown(ShieldBlock, false) and IsSpellKnown(Taunt, false) then end
                else C_Timer.After(3, ReRoll)  --To loop back to the button frame
end
frame:RegisterEvent("LEARNED_SPELL_IN_TAB")

The first part of the code I am trying to create a button that will use an item in my inventory (ID: 777992) and then automatically click yes on the pop up box (StaticPopup1Button1:Click() ) checking if I want to use the item.

The second part is to check if the skills I am looking for have been learned or not.

What Im trying to figure out is how can I get it to Loop so if the skills are not learned it can automatically use the item (777992) and click the check box over and over. It would need to be on a 3 second timer for the loop.

This code is for 3.3.5 in case it makes much difference

Essentially I want to create a button that will use an item and accept the pop up, check if certain spells are learnt and then automatically re use the item and accept the pop up if the skills are not learnt/ on action bar.

Terenna 05-02-19 05:08 PM

Quote:

Originally Posted by Maulkin (Post 332014)
This code is for 3.3.5 in case it makes much difference.

RIP mate. Can't help you here.

Seerah 05-02-19 06:18 PM

Discussion of Private Servers, in any manner other than theoretical, is completely against our rules. We are an Official Fan Site. We follow Blizzard's rules, on top of our own rules.

Threads requesting assistance with Private Servers get locked. Repeated postings get you banned.


All times are GMT -6. The time now is 10:02 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI