View Single Post
06-20-13, 12:53 PM   #1
devilArt
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 51
auto take screenshot when bg/arena finished

i took these code from shestakui, it could auto take a screenshot when you earned a achievement, but I want it auto take a screenshot when bg/arena finished too, is there anyone know how to modify it?


Lua Code:
  1. local function TakeScreen(delay, func, ...)
  2.     local waitTable = {}
  3.     local waitFrame = CreateFrame("Frame", "WaitFrame", UIParent)
  4.     waitFrame:SetScript("onUpdate", function (self, elapse)
  5.         local count = #waitTable
  6.         local i = 1
  7.         while (i <= count) do
  8.             local waitRecord = tremove(waitTable, i)
  9.             local d = tremove(waitRecord, 1)
  10.             local f = tremove(waitRecord, 1)
  11.             local p = tremove(waitRecord, 1)
  12.             if d > elapse then
  13.                 tinsert(waitTable, i, {d-elapse, f, p})
  14.                 i = i + 1
  15.             else
  16.                 count = count - 1
  17.                 f(unpack(p))
  18.             end
  19.         end
  20.     end)
  21.     tinsert(waitTable, {delay, func, {...} })
  22. end
  23.  
  24. local function OnEvent(...)
  25.     TakeScreen(1, Screenshot)
  26. end
  27.  
  28. local frame = CreateFrame("Frame")
  29. frame:RegisterEvent("ACHIEVEMENT_EARNED")
  30. frame:SetScript("OnEvent", OnEvent)
  Reply With Quote