- Joined
- Feb 4, 2008
- Messages
- 3,499
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:
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:
An example could be:
JASS:
call MultiboardSetItemValueBJ( udg_StatusBoard[udg_PlayerNR], 1, 2, ConfigureBars(50.) )
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