All that stuff is pretty much a mess right now. My prompt trigger is very custom and wouldn't be of much use to you unless you have all those same options available to you.
Basically, I have current and max values saved to variables. Then I use 2 sets of 4 gradients to create the 3D-ish graphs and use the text shadowing method to place the text over that.
This code is written in Lua.
Here's some bits of that code:
-- HP bar graph
local hp_perc = math.ceil((var.HP_CUR/var.HP_MAX) * 100)
left = 3
-- barwidth is width in pixels, defined earlier in the script
local hp_right = left + math.ceil(barwidth*(hp_perc*.01))
-- see below for Window.gradient3 function
-- This gradient is the "background" colour
Window.gradient3( win, hp_right, top, left+barwidth, bottom,
ColourNameToRGB("midnightblue"),
ColourNameToRGB("indigo"),
ColourNameToRGB("mediumorchid"))
-- This gradient is the "foreground" colour, actual percentage of HP
Window.gradient3( win, left, top, hp_right, bottom,
ColourNameToRGB("maroon"),
ColourNameToRGB("red"),
ColourNameToRGB("lightcoral"))
-- draw a frame around it. not necessary
WindowRectOp (win, 5, left - 1, top - 1, left + barwidth + 1, bottom + 1, 5, 15)
-- add shadowed text. See below for Window.textshadow function
Window.textshadow( win, "f",
"HP: " .. var.HP_CUR .. "/" .. var.HP_MAX .. ("..hp_perc.."%)",
left + 4, top, left+barwidth, bottom,
ColourNameToRGB("white"),
ColourNameToRGB("black") )
Window.gradient3 function. This creates a 3D-ish-style rounded horizontal bar graph. I use 2 of these to create a foreground graph and background "empty" graph.
function Window.gradient3( win, left, top, right, bottom, colour1, colour2, colour3 )
local Win = win or ""
local Left = left or 0
local Top = top or 0
local Right = right or 0
local Bottom = bottom or 0
local Colour1 = colour1 or ColourNameToRGB("black")
local Colour2 = colour2 or ColourNameToRGB("gray")
local Colour3 = colour3 or ColourNameToRGB("silver")
local Width = Right - Left
local Height = Bottom - Top
WindowGradient (Win, Left, Top, Right, Top+math.ceil(Height*.25), Colour1, Colour2, 2)
WindowGradient (Win, Left, Top+math.ceil(Height*.25), Right, Top+math.ceil(Height*.50), Colour2, Colour3, 2)
WindowGradient (Win, Left, Top+math.ceil(Height*.50), Right, Top+math.ceil(Height*.75), Colour3, Colour2, 2)
WindowGradient (Win, Left, Top+math.ceil(Height*.75), Right, Bottom, Colour2, Colour1, 2)
end
Window.textshadow function. This function is pretty much the same thing Nick demonstrated in another thread. I put the code into a function so it could be reused and added options for supplied colours and defaults if they were not supplied. It doesn't have any error trapping if something is not supplied, which will probably be added later.
function Window.textshadow( win, font, msg, left, top, right, bottom, colour, bgcolour )
local Colour = colour or ColourNameToRGB("white")
local BGColour = bgcolour or ColourNameToRGB("darkgray")
WindowText (win, font, msg, left + 1, top + 1,
0, 0, BGColour, false)
local ret = WindowText (win, font, msg, left, top,
0, 0, Colour, false)
return ret -- return 'right' from top layer text
end
|