View Single Post
10-01-16, 01:58 AM   #12
luanoob
A Murloc Raider
Join Date: Sep 2016
Posts: 4
Originally Posted by Sweetsour View Post
Lua Code:
  1. Code

Made changes to lines 10, 12, 27, and 29.

In the last elseif (line 29), try encapsulating the "or" conditions within brackets.
Originally Posted by sticklord View Post
Hey.

The reason why it's not working is because you made your "combatcheck" local inside the onevent function. So every time the UNIT_AURA event fires, combatcheck will be false. Also, there a boolean data type you can use instead of string. (true/false without the quotation mark)

Try this:
Lua Code:
  1. local combatcheck = false
  2.  
  3. textFrame:RegisterUnitEvent("UNIT_AURA", "player")
  4. textFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
  5. textFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
  6. textFrame:SetScript("OnEvent", function(self, event, ...)
  7.  
  8.     if event=="PLAYER_REGEN_DISABLED" then
  9.         combatcheck = true
  10.  
  11.     elseif event =="PLAYER_REGEN_ENABLED" then
  12.         combatcheck = false
  13.     end
  14.  
  15.     local count = 0
  16.     for buff in pairs(buffs) do
  17.         if UnitBuff("player", buff) then
  18.             count = count + 1
  19.         end
  20.     end
  21.  
  22.     --  Give warning if need to reroll the bones
  23.     if not combatcheck then
  24.         textFrame:message("")
  25.     elseif UnitBuff("player", "True Bearing") or UnitBuff("player", "Shark Infested Waters") or count >= 2 then
  26.         textFrame:message("")
  27.     else
  28.         textFrame:message("REROLL THE BONES!!".." "..tostring(combatcheck))
  29.     end
  30. end)
That did it
Thanks a lot guys, really appreciate it!
  Reply With Quote