percentage bar -> |||||||||

Level 1
Joined
Dec 24, 2007
Messages
2
ok in shopping maul they have this bar that shows a percentage of how many lives you have and looks like this ||||||||||||||||||

how would i make something like this?? i tried for about an hour and then i searched the forums but couldnt find anything
 
Level 3
Joined
Jan 9, 2008
Messages
24
//pseudo code
JASS:
function getRed takes nothing returns string
return |cffFF0000
endfunction

function getBlue takes nothing returns string
return |cff0000FF
endfunction

function draw takes integer livesLeft, integer maxLives returns string
local string showLives
local integer counter
set showLives = getRed()
set counter = 1
loop
counter = counter + 1
exitwhen counter > livesLeft
showLives = showLives + " | "
endloop

showLives = showLives + getBlue()

loop
counter = counter + 1
exitwhen counter > maxLives
showLives = showLives + " | "
endloop

endfunction

you can try that code, havent tested it myself, but the idea should be correct
 
Level 4
Joined
May 13, 2007
Messages
75
Yeah, I have been looking for that too for a while. Will try it out as soon as I get home. +rep
 
Top