View Single Post
02-09-18, 08:07 AM   #1
Coldkil
A Cliff Giant
 
Coldkil's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2010
Posts: 70
split statusbars

Hi, it's been a long time from the last i made something for wow. Now i'm back at it with a new(?) thing (at least for me)

The idea was to make customized split statusbars. Example: you have the HP bar divided in 3 smaller ones that are updated accordingly, which each one representing the 0-33, 33-66, 66-100 portions.

Idea was to either used masks/textures, but with me being inept at photoshop i opted towards another solution, to actually manually create the smaller statusbars and use the SetMinMaxValues() methods.

pseudocode here (function/events names may be incorrect, just going with memory).
Code:
-- created 3 frames as containers 
-- created 3 statusbars 

hp1:SetMinMaxValues(0,maxhp/3)
hp2:SetMinMaxValues(maxhp/3, maxhp/3*2)
hp3:SetMinMaxValues(maxhp/3*2, maxhp)

local function UpdateHP(bar)
    cur = UnitHealth("player")
    if cur then bar:SetValue(cur) end
end

local function UpdateAll()
     UpdateHP(hp1)
     UpdateHP(hp2)
     UpdateHP(hp3)
end

-- create a frame to hold a script
frame:RegisterEvent("PLAYER_HEALTH_FREQUENT")
frame:SetScript('OnEvent', UpdateAll())
If there are errors in code like variables scope, it's not a problem and it's fixable - what i wanted to know is if there are any logical fallacies with this approach like "you cannot update too many bars together for a game limitation" or similar.

I know already that i could simply design a texture the size of a bar made by how many shapes i want and use a transparent statusbar that overlaps the same texture on background with a different color to obtain a very similar if not equal effect. however this way evry single doodad is an element of its own, letting me to experiment with positioning and designs different from a standard | | | | | | | | | or - - - - - - - -

Hope i've benn clear, and thanks to anyone wants to dedicate its spare time to help me.
  Reply With Quote