Page 1 of 1
[0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 7:29 am
by Dysoch
When you create a progress bar with any size, and then set the value, the bar fills completely:
Steps to reproduce:
1) create the progress bar:
Code: Select all
/c game.player.gui.top.add{name="foo", type="progressbar", size=100}
2 )then set the value of that bar:
Code: Select all
/c game.player.gui.top.foo.value = 50
the bar instantly fills. With any number this always happens.

Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 7:51 am
by Rseding91
I thought progress bars where a percent of 1?
Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 8:10 am
by Dysoch
Rseding91 wrote:I thought progress bars where a percent of 1?
they should, but the bar just instantly fills with any number which is less then the size.
when you set the size at 100, and the value at 50, it should be half, but it shows completely filled
sounds like a bug to me

Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 8:58 am
by Oxyd
Huh? If the domain of .value is [0, 1] and you set it to 50, it should fill completely. Or do you have any source saying that .value = 50 should make it half full?
Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 9:02 am
by FishSandwich
If it works the same way as player health then you need to use fractions between 0 and 1. Anything above 1 is considered 1.
So for half the bar, you'll use 0.5
Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 9:07 am
by Dysoch
FishSandwich wrote:If it works the same way as player health then you need to use fractions between 0 and 1. Anything above 1 is considered 1.
So for half the bar, you'll use 0.5
mmm, your right. But it seems silly. then on the wiki its not specified correctly
needs to say that you need to use decimals for the value, or alter the game to use full numbers.
https://forums.factorio.com/wiki/inde ... BarElement
Re: [0.12.x] GUI: Progress bar not working as expected
Posted: Thu Aug 20, 2015 1:10 pm
by Dysoch
updated wiki to this information