Quantcast New to lua, need help implementing a loop. - WoWInterface
Thread Tools Display Modes
05-02-19, 04:38 PM   #1
A Defias Bandit
Join Date: May 2019
Posts: 1
New to lua, need help implementing a loop.

Hello All,

This is my current 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:SetAttribute("enabled", true)
button:SetPoint("TOP", 0, -150)
button:SetSize(32, 32)

local frame = CreateFrame('Frame')
frame:SetScript('OnEvent', function(self, event, ...)
    frame[event](self, ...)
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 
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.
05-02-19, 05:08 PM   #2
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 103
Originally Posted by Maulkin View Post
This code is for 3.3.5 in case it makes much difference.
RIP mate. Can't help you here.
05-02-19, 06:18 PM   #3
Fishing Trainer
Seerah's Avatar
WoWInterface Super Mod
Join Date: Oct 2006
Posts: 10,691
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.
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh


WoWInterface » Developer Discussions » Lua/XML Help » New to lua, need help implementing a loop.

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