View Single Post
04-30-19, 08:13 PM   #6
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 223
To clarify, WoW addon code is loaded sequentially and an infinite loop would halt it.
Using an event like LEARNED_SPELL_IN_TAB may help as it fires when a new spell is added/learned.

Lua Code:
  1. local frame = CreateFrame('Frame')
  2. frame:SetScript('OnEvent', function(self, event, ...)
  3.     frame[event](self, ...)
  4. end
  5.  
  6. function frame:LEARNED_SPELL_IN_TAB(self, ...)
  7.     local a = IsSpellKnown(72, false)
  8.     local b = IsSpellKnown(73, false)
  9.     local c = IsSpellKnown(74, false)
  10.     local d = IsSpellKnown(75, false)
  11.  
  12.     if a and b and c and d then
  13.         ChangeActionBarPage(2)
  14.     end
  15. end
  16. frame:RegisterEvent("LEARNED_SPELL_IN_TAB")
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote