Thread Tools Display Modes
07-26-16, 07:17 PM   #1
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Quick question about oUF Tag

I was trying to create a Name text which colors name with raidcolor while level is not and here's how I've done it.

Lua Code:
  1. A.CreateNameText = function(f, unit)
  2.     local Name = f.Health:CreateFontString("$parentName", "OVERLAY");
  3.     Name:SetFont(NAME_FONT, 12, "OUTLINE");
  4.  
  5.     if unit == "player" then
  6.         Name:SetPoint("BOTTOMLEFT", f.Health, "TOPLEFT", 0, 2);
  7.  
  8.         f:Tag(Name, "[level] [raidcolor][name]|r");
  9.     elseif unit == "target" then
  10.         Name:SetPoint("BOTTOMRIGHT", f.Health, "TOPRIGHT", 0, 2);
  11.  
  12.         f:Tag(Name, "[raidcolor][name]|r [level][plus]");
  13.     elseif unit == "targettarget" then
  14.         Name:SetPoint("CENTER", f.Health, "CENTER");
  15.  
  16.         f:Tag(Name, "[raidcolor][name]|r");
  17.     end
  18. end

I have added |r at the end of [name] tag in order to prevent the next texts being effected by [raidcolor] tag.

This seems to be working, but I am not sure whether there is another possible built in solution for this within oUF.
(I had a look at Tag.lua file and failed to find something that is related to this... )

Last edited by Layback_ : 07-26-16 at 07:21 PM.
  Reply With Quote
07-26-16, 07:39 PM   #2
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Layback_ View Post
I was trying to create a Name text which colors name with raidcolor while level is not and here's how I've done it.

-- code

I have added |r at the end of [name] tag in order to prevent the next texts being effected by [raidcolor] tag.

This seems to be working, but I am not sure whether there is another possible built in solution for this within oUF.
(I had a look at Tag.lua file and failed to find something that is related to this... )
That's not even oUF feature, that's just how colouring works. |cffff00ccTEXT|r will make TEXT be pink. [raidcolor] is "|cff..color_hex" part, [name] is your TEXT in this case, so you need to add "|r" on your own.
__________________

Last edited by lightspark : 07-26-16 at 07:42 PM.
  Reply With Quote
07-26-16, 08:28 PM   #3
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by lightspark View Post
That's not even oUF feature, that's just how colouring works. |cffff00ccTEXT|r will make TEXT be pink. [raidcolor] is "|cff..color_hex" part, [name] is your TEXT in this case, so you need to add "|r" on your own.
Yeah, I know |r is not oUF feature

What I meant was whether there is a replacement feature of that thing built in oUF or not.

Since you are saying that I have to add that thing on my own, looks like there is no replacement feature for that and is the one that I'll have to use.

I apologize if I confused you

and thank you for explanation!

Last edited by Layback_ : 07-26-16 at 08:33 PM.
  Reply With Quote
07-26-16, 09:19 PM   #4
lightspark
A Rage Talon Dragon Guard
 
lightspark's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2012
Posts: 341
Originally Posted by Layback_ View Post
Yeah, I know |r is not oUF feature

What I meant was whether there is a replacement feature of that thing built in oUF or not.

Since you are saying that I have to add that thing on my own, looks like there is no replacement feature for that and is the one that I'll have to use.

I apologize if I confused you

and thank you for explanation!
Well, one more thing then. If you do not need to alter text colours again, you can omit |r.
Lua Code:
  1. f:Tag(Name, "[level] [raidcolor][name]");
will work w/o any issues.

And do you need replacement for |r? O_o If you need it that badly, you can create a tag like [r]
__________________

Last edited by lightspark : 07-26-16 at 09:26 PM.
  Reply With Quote
07-26-16, 10:03 PM   #5
Layback_
An Onyxian Warder
Join Date: Feb 2016
Posts: 358
Originally Posted by lightspark View Post
Well, one more thing then. If you do not need to alter text colours again, you can omit |r.
Lua Code:
  1. f:Tag(Name, "[level] [raidcolor][name]");
will work w/o any issues.

And do you need replacement for |r? O_o If you need it that badly, you can create a tag like [r]
nah~

|r will be enough for me to use with

Thanks a lot!!!!!!!!!!!!!!!!!!!!!!!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Quick question about oUF Tag


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