Shestak UI
Go Back   Shestak UI > Interface Forums > English Community > Technical Support

Technical Support Ask for help or find solutions about ShestakUI.

Advertising

 
Thread Tools
Old 24.02.2015, 00:09   #1
 Assistant User Information

sinaris's Avatar
Lightbulb ShestakUI/Modules/Automation/Screenshots.lua

Take a look at the current ShestakUI/Modules/Automation/Screenshots.lua

lua Code [Select]:
local T, C, L, _ = unpack(select(2, ...))
if C.automation.screenshot ~= true then return end

----------------------------------------------------------------------------------------
--  Take screenshots of Achievements(Based on Achievement Screenshotter by Blamdarot)
----------------------------------------------------------------------------------------
local function TakeScreen(delay, func, ...)
    local waitTable = {}
    local waitFrame = CreateFrame("Frame", "WaitFrame", UIParent)
    waitFrame:SetScript("onUpdate", function (self, elapse)
        local count = #waitTable
        local i = 1
        while (i <= count) do
            local waitRecord = tremove(waitTable, i)
            local d = tremove(waitRecord, 1)
            local f = tremove(waitRecord, 1)
            local p = tremove(waitRecord, 1)
            if d > elapse then
                tinsert(waitTable, i, {d-elapse, f, p})
                i = i + 1
            else
                count = count - 1
                f(unpack(p))
            end
        end
    end)
    tinsert(waitTable, {delay, func, {...} })
end

local function OnEvent(...)
    TakeScreen(1, TakeScreenshot)
end

local frame = CreateFrame("Frame")
frame:RegisterEvent("ACHIEVEMENT_EARNED")
frame:SetScript("OnEvent", OnEvent)


There is a way better thing todo this with a default WoW API function now.

lua Code [Select]:
----------------------------------------------------------------------------------------
--  Take screenshots of defined events (Sinaris)
----------------------------------------------------------------------------------------
--
local T, C, L, _ = unpack( select( 2, ... ) )

if( C['automation']['screenshot'] ~= true ) then
    return
end

local function OnEvent( self, event, ... )
    C_Timer.After( 1, function() Screenshot() end )
end

local EventFrame = CreateFrame( 'Frame' )
EventFrame:RegisterEvent( 'ACHIEVEMENT_EARNED' )
EventFrame:SetScript( 'OnEvent', OnEvent )

Maybe you can use this smart lines of codes instead of that current one
Say Thank:
Shestak (27.02.2015)
Old 24.02.2015, 00:09   #1.5 - Disable Ads

Advertise on this site


Tags
c_timer.after, screenshot, sinaris

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Fixed] Modules\Skins\Blizzard\Garrison.lua F5Hellbound Bugs Reports 2 17.12.2014 20:19
[Fixed] Modules/Misc/SlotItemLevel.lua F5Hellbound Bugs Reports 1 25.05.2014 13:16


Mobile Style Русский English Deutsch Italian Chinese