Thread: frame replacing
View Single Post
10-02-14, 04:56 PM   #1
Danielps1
Guest
Posts: n/a
frame replacing

Hi,

There is a simple boolean variable which determines if some "all" debuffs are shown or only own debuffs(of the target).

So when = true then it will only show own debuffs
when = false it will show all debuffs

I want to make a modifier with the shift key to show all debuffs when the shiftkey is pressed and hide them again when shift is realeased.

Lua Code:
  1. if IsShiftKeyDown() then
  2.  cfg.aura.onlyShowPlayer = false
  3.  else
  4.  cfg.aura.onlyShowPlayer = true
  5.  end


This is my very simple solution for it which works. The problem here is though it only works on starting of the script. That is not very efficent because I would send my user into a loadingscreen.

OnUpdate should fix my problem here which will run this specific code everytime a frame gets rendered which is pretty handy and is what I want to accomplish.

So this is what I made

Lua Code:
  1. local function onUpdate(self,elapsed)
  2.  if IsShiftKeyDown() then
  3.  cfg.aura.onlyShowPlayer = false
  4.  else
  5.  cfg.aura.onlyShowPlayer = true
  6.  end
  7.  end
  8.  
  9.  local shiftdebuffs = CreateFrame("frame")
  10.  shiftdebuffs:SetScript("OnUpdate", onUpdate)


My problem is now that it doesn't work. I new to the onUpdate stuff and only copy pasted it from another addon I did which worked fine.
Right it goes straight to = false, which is only happening I think because it is the default.

thanks for the help

weird title, can't change it.

Last edited by Danielps1 : 10-05-14 at 09:55 AM.
  Reply With Quote