• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

Another jass question:

Status
Not open for further replies.
This function is supposed to return a string when called, a so called bar to be used inside my multiboard. The real taken is how many bars remaining out of 100.

An example could be:

JASS:
call MultiboardSetItemValueBJ( udg_StatusBoard[udg_PlayerNR], 1, 2, ConfigureBars(50.) )
This would return an 50% green bar in the multiboard.
Example of example: [||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||]
This would of cause be shorter as the editor don put space between "|"

However doing this currently returns not only nothing, it removes all lines beneath the appropiate line in the multiboard.
I would suspect this to be because it loops a lot of "empty spaces", but I have no clue to fix it.

The function is as follows:

JASS:
function ConfigureBars takes real barcurrent returns string
local integer size = 2 // 2 = half
local real barmax = 100.
local integer greenbars = R2I(barcurrent) / size
local integer redbars = R2I(barmax - barcurrent) / size
local integer counter
local string bar = ""


loop
set counter = counter +1
if counter <= greenbars then
set bar = ( bar + "|c0000FF00||r " )
else
set bar = ( bar + "|c00FF0000||r " )
endif

exitwhen counter >= 100 / size
endloop

set bar = ( "[" + bar + "]" )


return bar
endfunction
 
Status
Not open for further replies.
Back
Top