• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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

Status
Not open for further replies.
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
 
Status
Not open for further replies.
Top