Loading...

Custom Texts and installer

#1
Been working on a new layout. I'm using customTexts again and I know I need to initialize them in the installer to make it work.

Code: Select all

E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["PlayerH"] or {}
E.db["unitframe"]["units"]["player"]["customTexts"]["PlayerH"] = {
	["attachTextTo"] = "Health",
	["enable"] = true,
	["text_format"] = "[health:current]",
	["yOffset"] = 0,
	["font"] = "Impacted",
	["justifyH"] = "RIGHT",
	["fontOutline"] = "OUTLINE",
	["xOffset"] = 0,
	["size"] = 20,
}

E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["PlayerLevel"] or {}
E.db["unitframe"]["units"]["player"]["customTexts"]["PlayerLevel"] = {
	["attachTextTo"] = "Health",
	["xOffset"] = 0,
	["text_format"] = "[level]",
	["yOffset"] = 19,
	["font"] = "Impacted",
	["justifyH"] = "LEFT",
	["fontOutline"] = "OUTLINE",
	["size"] = 11,
}

E.db["unitframe"]["units"]["target"]["customTexts"] = E.db["unitframe"]["units"]["target"]["TargetH"] or {}
E.db["unitframe"]["units"]["target"]["customTexts"]["TargetH"] = {
	["attachTextTo"] = "Health",
	["enable"] = true,
	["text_format"] = "[health:current]",
	["yOffset"] = 0,
	["font"] = "Impacted",
	["justifyH"] = "LEFT",
	["fontOutline"] = "OUTLINE",
	["xOffset"] = 2,
	["size"] = 20,
}
In this example my PlayerLevel custom text is working as intended, the PlayerH custom text isn't. Nothing is being displayed and there is no error message. I tried to rename it multiple times thinking it might be the issue but no change. The health should look exactly the same as it does on these Arena frames except Justify Right on the Player frame and Justify Left on the Target frame.
Image

Code: Select all

E.db["unitframe"]["units"]["arena"]["customTexts"] = E.db["unitframe"]["units"]["arena"]["ArenaHealth"] or {}
E.db["unitframe"]["units"]["arena"]["customTexts"]["ArenaHealth"] = {
	["attachTextTo"] = "Health",
	["xOffset"] = 0,
	["text_format"] = "[health:current]",
	["yOffset"] = 0,
	["font"] = "Impacted",
	["justifyH"] = "CENTER",
	["fontOutline"] = "OUTLINE",
	["size"] = 20,
}

Custom Texts and installer

#2
Your lines are a bit wrong. Instead of this:

Code: Select all

E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["PlayerH"] or {}
It should be this:

Code: Select all

E.db["unitframe"]["units"]["player"]["customTexts"] = E.db["unitframe"]["units"]["player"]["customTexts"] or {}
The idea is that you check if the "E.db["unitframe"]["units"]["player"]["customTexts"]" table exists. If it does, then you assign the table to itself, effectively doing nothing. If it does not exist, then you assign a new empty table to it.

It's the same as doing:

Code: Select all

if not E.db["unitframe"]["units"]["player"]["customTexts"] then
    E.db["unitframe"]["units"]["player"]["customTexts"] = {}
end
This only has to be done once for each unit.
ElvUI: Request Feature | Report Bug

My replies might be short sometimes due to time constraints. Nothing personal.

Who is online

Users browsing this forum: No registered users and 0 guests