A Murloc Raider
Join Date: Mar 2010
Posts: 7
|
Originally Posted by Katae
Gradients with a stats display
I'll start with some scripts I've been using. This is the same layout code I used for the stats display, copy and paste this into the default or your character's profile. This also demonstrates the built-in class coloring.
If you want to only use the gradient box, you could remove the stats panel (name = "Stats") and tweak the dimensions, locations, and colors. (Font in the screenshot is 04B_03)
Code:
lpanels:CreateLayout("Stats", {
-- Stat Container
{ name = "Container",
anchor_to = "TOP",
width = 280, height = 20,
x_off = 0, y_off = -30,
bg_alpha = 0,
},
-- Left mid-section of the box
{ name = "BoxL", parent = "Container",
anchor_to = "LEFT",
width = "50%", height = "100%",
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0, gradient_alpha = 0.2,
},
-- Right mid-section
{ name = "BoxR", parent = "Container",
anchor_to = "RIGHT",
width = "50%", height = "100%",
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0.2, gradient_alpha = 0,
},
-- Top Left gradient line
{ name = "LineTL",
parent = "BoxL", anchor_to = "TOP",
width = "100%", height = 1,
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0, gradient_alpha = 0.8,
},
-- Top right line
{ name = "LineTR",
parent = "BoxR", anchor_to = "TOP",
width = "100%", height = 1,
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0.8, gradient_alpha = 0,
},
-- Bottom left line
{ name = "LineBL",
parent = "BoxL", anchor_to = "BOTTOM",
width = "100%", height = 1,
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0, gradient_alpha = 0.8,
},
-- Bottom right line
{ name = "LineBR",
parent = "BoxR", anchor_to = "BOTTOM",
width = "100%", height = 1,
gradient = "H",
bg_color = "CLASS", gradient_color = "CLASS",
bg_alpha = 0.8, gradient_alpha = 0,
},
-- Text display
{ name = "Stats", parent = "Container",
anchor_to = "CENTER", anchor_from = "CENTER",
text = {
string = function()
-- monies
local gold = format("%.1f|cffffd700g|r",GetMoney()/10000)
-- durability
local durability = 100
for i = 1, 11 do
if GetInventoryItemDurability(i) ~= nil then
local dur, max = GetInventoryItemDurability(i)
local perc = dur / max * 100
if perc < durability then
durability = floor(perc)
end
end
end
-- fps
local fps = floor(GetFramerate())
-- memory
local memory = 0
UpdateAddOnMemoryUsage()
for i = 1, GetNumAddOns() do
if IsAddOnLoaded(i) then
memory = memory + GetAddOnMemoryUsage(i)
end
end
memory = format("%.1f", memory/1024)
-- latency
local latency = select(3,GetNetStats())
return format(":: %s :: %s%%dur :: %sfps :: %smB :: %sms ::", gold, durability, fps, memory, latency)
end, update = 1,
size=10, shadow=1, font = "Fonts\\FRIZQT__.TTF",
}
}
}); lpanels:ApplyLayout(nil, "Stats")
|
Say if I wanted to add the server time into that, how would I go about doing that (so tottaly noob to this)
btw love this! makes my ui look so clean!
|