Thread Tools Display Modes
08-13-11, 11:03 PM   #1
Dangergoppel
A Murloc Raider
Join Date: Oct 2008
Posts: 7
Hiding stuff while casting

I'm very new to LUA, so this is probably a noob question, but here goes anyway.

I'm creating my own oUF layout, and want to hide some of the units' health/mana/stuff-like-that text while the unit is casting. How in the world do I do this?

Thanks in advance for any help.
  Reply With Quote
08-14-11, 03:53 AM   #2
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
oUF's castbar-element provides the possibility to hook the 'casting', so you can execute a function, when a cast starts.

Use castbar:PostCastStart(unit, name, nil, castid) and castbar:PostChannelStart(unit, name) to hide certain elements.

However, you will have to restore, what you have hidden, so you will have to use castbar:PostChannelStop(unit, spellname) and castbar:PostCastStop(unit, spellname, nil, castid) aswell to show the elements again.

Have a look at oUF/elements/castbar.lua to get a deeper look.
__________________
  Reply With Quote
08-15-11, 07:06 AM   #3
Dangergoppel
A Murloc Raider
Join Date: Oct 2008
Posts: 7
Again, I'm very new, so I'm actually not very sure how to use those together with anything else. <_<'
  Reply With Quote
08-15-11, 10:08 AM   #4
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
k, let's go a little deeper then...

You got something like this:

lua Code:
  1. -- self.Health.value = someSortOfFontString
  2. -- self.Power.value = someSortOfFontString
  3.  
  4. -- self.Castbar = someSortOfFrameWithAllNecessaryCastbarStuff

What you have to add, is a function to hide self.Health.value and self.Power.value and another function to show them again:

lua Code:
  1. local function myPostCastStart(self)
  2.     self.Health.value:Hide()
  3.     self.Power.value:Hide()
  4. end
  5.  
  6. local function myPostCastStop(self)
  7.     self.Health.value:Show()
  8.     self.Power.value:Show()
  9. end
  10.  
  11. -- now attach that functions to your castbar (inside of your styling function):
  12.  
  13. -- self.Castbar = someSortOfFrameWithAllNecessaryCastbarStuff
  14. self.Castbar.PostCastStart = myPostCastStart
  15. self.Castbar.PostChannelStart = myPostCastStart
  16. self.Castbar.PostCastStop = myPostCastStop
  17. self.Castbar.PostChannelStop = myPostCastStop

This is highly drycoded and my last attempt to help without seeing code... It's just guessing where your problem is. Bring up some code and we'll try to help.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hiding stuff while casting


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