Help with some Font settings
EDIT:
Disreguard this post.. Was able to work most of the issues out with the "search" function. for those that might want to see the code im currently using. This code was posted by Phanx and editied to my likeing. Code:
local shorts = { Coke |
Öhm. :)
What is C["unitframes"].fontStyle and where does it come from? |
I've been able to do the following for the player but how would I do this for Arean and boss frames?
Code:
PlayerFrameHealthBarText:SetFont(C["media"].font, C["unitframes"].player.fontSize,"THINOUTLINE"); |
I vaguely remember posting that... not sure if it was in my original version, or from your edits, but here's a slightly more efficient version:
Code:
local shorts = { Quote:
Code:
local font, _, flags = fontstring:GetFont() Code:
local font, _, flags = TextStatusBarText:GetFont() |
Quote:
I want to be able to adjust each frames font size individually per what the user wants. I think ill just stick with doing it the long way per frame. Thanks Coke PS this is what im talking about the long way. My current unitframes addon: Code:
local B, C, DB = unpack(select(2, ...)) -- Import: B - function; C - config; DB - Database |
One more question concerning font.
How can I make the following font classcolor to match the person:
Thanks for any help with this. |
The simplest solution is probably going to be to hook the function that sets the text:
Code:
hooksecurefunc("UnitFrame_Update", function(self) If you wanted to color pets by their owner's class, the simplest solution would probably be to look at the pet's creature type and just make an assumption -- eg. beast = hunter, demon = warlock, etc. |
Quote:
Thank you for this it works great. Im confused on trying to do the "reaction" part. I've tried: Code:
self.name:SetTextColor(FACTION_BAR_COLORS[reaction].r, FACTION_BAR_COLORS[reaction].g, FACTION_BAR_COLORS[reaction].b) Even tried: Code:
FACTION_BAR_COLORS = { and thanks again for all your help. Coke P.S. Error I keep getting: Code:
Message: ...ace\AddOns\BasicUI\Modules\Unitframes\Unitframes.lua:199: attempt to index field '?' (a nil value) |
Post your entire code if you want help with it. Your snippet refers to a variable that may or may not be defined correctly or incorrectly or at all somewhere else, but you didn't post that part, so it really tells me nothing.
|
Entire Code
Sorry about that.
Unitframes.lua: Lua Code:
Defaults.lua: Lua Code:
Engine.lua: Lua Code:
Config.lua: Lua Code:
Is there any other code that you might need? Coke |
UnitReaction can return nil. Here's a version based on the coloring in my oUF layout that will do class colors for players, or gray for tapped units, or reaction colors for other units, with a fallback in case of invalid class/reaction data:
Lua Code:
|
Quote:
What I was able to use was the name coloring from nTooltip with some modifications. The only down fall to this coding is that the player's name is not class color matched, but all targets become classcolor, grey for dead or tapped, and normal color for npc's. Here is the code: Lua Code:
Thanks for the help on this. One last quest for you Phanx The numeric code seems to show 0 ("Zero") when a target is dead is there a way to remove these when the target is dead? Something like: Lua Code:
Again Thank You for all your help with the coding. Coke |
Your code is creating a new copy of a function every time any unit frame is updated, which is really bad. It's also hardcoding the unit to "target" which is probably not what you want, unless you only want your code to work on the target frame, in which case it's still the wrong way to go about it; if you want to limit it to the target frame, you need to check the actual unit and return out if it's not "target", as the current method will color every unit frame according to the properties of your current target.
The code I posted has nothing to do with oUF or tags, but after looking at it again, I see I forgot to define the "unit" variable. You should really have some kind of error display turned on. It will make things so much easier for you (and anyone else who tries to help you) while you're working with code. If you already have one (I recommend BugSack) then you should really post the error message when you report that something "doesn't work". Anyway, here is a fixed version: Code:
hooksecurefunc("UnitFrame_Update", function(self) Code:
hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax) |
Quote:
Also installed bugsack as suggested. Right now no errors. Thanks again for all your help. Coke |
Pet Name Color to White
I've been trying all morning to get the pet eg beast, demon, and elemental to have there names white.
At first I tried UnitIsPet(unit) but it seems that the wow api does not have that in it. Then I went searching and found UnitCreatureType(unit) then I tried: Lua Code:
But the above code turned every name color white. So I did more searching and found a post that had a function created for UnitIsPet so I copy/pasted the: Lua Code:
Lua Code:
and this changes the Pet name color to White but bugsack gives me this error: Code:
5x BasicUI-5.4.4\Modules\Unitframes\Unitframes.lua:193: bad argument #1 to "strsub" (string expected, got nil) Hopefully this is enough info for you. If not below is the complete Unitframes.lua just in case. Coke Unitframes.lua: Lua Code:
|
UnitGUID can return nil so you need to account for that:
Code:
local function UnitIsPet(unit) Code:
local function UnitIsPet(unit) Code:
if UnitCreatureType("beast") or UnitCreatureType("demon") or UnitCreatureType("elemental") then |
Quote:
I have added: Code:
local function UnitIsPet(unit) Thanks again Coke |
Based on what you are using it for you don't really need a separate UnitIsPet function, also the class name used to index CUSTOM_CLASS_COLORS and RAID_CLASS_COLORS should be in all caps:
Code:
hooksecurefunc("UnitFrame_Update", function(self) |
Quote:
Coke |
Statusbar Text
the following code was supplied by Phanx but I was wondering if there is a way to make it do the following.
Full Health = 345K Full Mana = 160K Not Full Health = 160K/345K Not Full Mana = 80K/160K Code Supplied by Phanx: Lua Code:
Thank in advance for any help. Coke |
All times are GMT -6. The time now is 07:25 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI