A Murloc Raider
Join Date: Mar 2010
Posts: 7
|
Originally Posted by Katae
You can just add this code, then add the variables hour and minute to the end of the existing format function, like so:
Code:
-- Server Clock
local hour, minute, aptime, pm = GetGameTime(), true
if aptime then
if hour == 0 then hour = 12 end
if hour > 12 then hour = hour - 12 end
if hour >= 12 then pm = true end
end
return format(":: %s :: %s%%dur :: %sfps :: %smB :: %sms :: %s:%s%s ::", gold, durability, fps, memory, latency, hour, minute, aptime and pm and "pm" or "am" or "")
Should work, did not test.
|
Its all gone now this is what I have.
Code:
lpanels:CreateLayout("Stats", {
-- Stat Container
{ name = "Container",
anchor_to = "BOTTOM",
width = 1020, height = 20,
x_off = 0, y_off = 0,
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())
-- Server Clock
local hour, minute, aptime, pm = GetGameTime(), true
if aptime then
if hour == 0 then hour = 12 end
if hour > 12 then hour = hour - 12 end
if hour >= 12 then pm = true end
end
return format(":: %s :: %s%%dur :: %sfps :: %smB :: %sms :: %s:%s%s ::", gold, durability, fps, memory, latency, hour, minute, aptime and pm and "pm" or
"am" or "")
end, update = 1,
size=10, shadow=1, font = "Fonts\\FRIZQT__.TTF",
}
}
}); lpanels:ApplyLayout(nil, "Stats")
|