Thread Tools Display Modes
04-02-10, 03:31 AM   #1
WildSkiff
A Kobold Labourer
Join Date: Oct 2008
Posts: 1
Question castbar text in place of helathbar text

How can i set castbar text in place of helathbar text?
I use:
Code:
self.Castbar.Text:SetAllPoints(self.Name)
but name stay under casttext while cast.
I want to healttext disappear when cast started and appear again after finish cast. is it possible?

Sorry for may bad English.
  Reply With Quote
04-02-10, 05:29 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Add a
Code:
self.Castbar.onshow = function()
and a
Code:
self.Castbar.onhide = function()
Inside the onshow function rewrite the name with the castbar text.
Code:
self.tempname = self.Name.Text
self.Name.Text = self.Castbar.Text
In the onhide function do
Code:
self.Name.Text = self.tempname
to reset it.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
04-02-10, 05:54 AM   #3
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
The onshow and onhide are doing nothing in my script, not even generating an error

lua Code:
  1. local beginCast = function(self)
  2.     print('test')
  3. end
  4.  
  5. local endCast = function(self)
  6.     print('test')
  7. end
  8.  
  9.     -- Castbar
  10.     if(unit == 'target' or unit == 'player') then
  11.         local cb = CreateFrame"StatusBar"
  12.         cb:SetStatusBarTexture(casttexture)
  13.         cb:SetStatusBarColor(1, .95, 0, 1)
  14.         cb:SetParent(self)
  15.         cb:SetAllPoints(hp)
  16.         cb:SetFrameLevel(2)
  17.         self.Castbar = cb      
  18.         self.Castbar.Text = self.Castbar:CreateFontString(nil, "OVERLAY")
  19.         self.Castbar.Text:SetPoint("LEFT", 3, 0)
  20.         self.Castbar.Text:SetPoint("RIGHT", -2, 0)
  21.         self.Castbar.Text:SetJustifyH"LEFT"
  22.         self.Castbar.Text:SetTextColor(1,1,1,1)
  23.         self.Castbar.Text:SetFont(font,14,"OUTLINE")
  24.         self.Castbar.onshow = beginCast
  25.         self.Castbar.onhide = endCast
  26.     end
  Reply With Quote
04-02-10, 07:30 AM   #4
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Try replacing your last two lines with this:
Code:
self.Castbar:SetScript("OnShow", beginCast)
        self.Castbar:SetScript("OnHide", endCast)
  Reply With Quote
04-02-10, 07:30 AM   #5
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Oh, I think I had still JavaScript in mind.
You could try ".Show" and ".Hide" instead but I'm not sure. It's too long ago.

What wurmfood wrote will work though.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 04-02-10 at 07:35 AM.
  Reply With Quote
04-02-10, 08:20 AM   #6
Sideshow
A Flamescale Wyrmkin
 
Sideshow's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2010
Posts: 103
Problem solved Thank you
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » castbar text in place of helathbar text


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