• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

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