Thread Tools Display Modes
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
10-05-14, 09:56 AM   #2
Danielps1
Guest
Posts: n/a
bump

~ 10 characters ~
  Reply With Quote
10-05-14, 10:32 AM   #3
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
You OnUpdate code is ok and does work as expected.

There must be something wrong within other parts of your code.
  Reply With Quote
10-05-14, 11:04 AM   #4
Danielps1
Guest
Posts: n/a
Originally Posted by Duugu View Post
You OnUpdate code is ok and does work as expected.

There must be something wrong within other parts of your code.
Hm, thanks atleast I'm good there. Sadly the rest of the code is from ouF_Skaarj and I don't really understand all of that.
This is what I found in Skarj's code

Lua Code:
  1. if cfg.aura.target_debuffs then
  2.             local d = CreateFrame('Frame', nil, self)
  3.             d.size = 23
  4.             d.spacing = 5
  5.             d.num = cfg.aura.target_debuffs_num
  6.             d:SetPoint('BOTTOMLEFT', self, 'TOPLEFT', 0, 8)
  7.             d:SetSize(cfg.player.width, d.size)
  8.             d.initialAnchor = 'TOPLEFT'
  9.             d.onlyShowPlayer = cfg.aura.onlyShowPlayer
  10.             d.PostCreateIcon = auraIcon
  11.             d.PostUpdateIcon = PostUpdateIcon
  12.             d.CustomFilter = CustomFilter
  13.             self.Debuffs = d      
  14.         end
  Reply With Quote
10-05-14, 11:12 AM   #5
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
So you're using an unmodified version of ouF_Skaarj and just would like to add a way to show your own auras on shift key?
  Reply With Quote
10-05-14, 11:13 AM   #6
Danielps1
Guest
Posts: n/a
Originally Posted by Duugu View Post
So you're using an unmodified version of ouF_Skaarj and just would like to add a way to show your own auras on shift key?
Well I changed a lot ouf things in terms of style, but yeah basically I want to do that. Skarj is sadly not aroun d or so, not sure.
  Reply With Quote
10-05-14, 12:16 PM   #7
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
I'm not that motivated to dig into the code of ouF_Skaarj to be honest. But this you be a quick and dirty solution.

Try to replace

Lua Code:
  1. local customFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster)
  2.     if((icons.onlyShowPlayer and icon.isPlayer) or (not icons.onlyShowPlayer and name)) then
  3.         return true
  4.     end
  5. end

in aura.lua with

Lua Code:
  1. local customFilter = function(icons, unit, icon, name, rank, texture, count, dtype, duration, timeLeft, caster)
  2.     if(((icons.onlyShowPlayer or IsShiftKeyDown()) and icon.isPlayer) or (not icons.onlyShowPlayer and name)) then
  3.         return true
  4.     end
  5. end

Didn't test this though.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » frame replacing


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off