[0.12.x] GUI: Progress bar not working as expected

Bugs that are actually features.
Post Reply
User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

[0.12.x] GUI: Progress bar not working as expected

Post 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.
Image
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post by Rseding91 »

I thought progress bars where a percent of 1?
If you want to get ahold of me I'm almost always on Discord.

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post 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 :D
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post 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?

FishSandwich
Smart Inserter
Smart Inserter
Posts: 1847
Joined: Sun Feb 23, 2014 3:37 pm
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post 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

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post 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
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

User avatar
Dysoch
Filter Inserter
Filter Inserter
Posts: 445
Joined: Fri Oct 18, 2013 2:27 pm
Contact:

Re: [0.12.x] GUI: Progress bar not working as expected

Post by Dysoch »

updated wiki to this information
Creator of:
- DyTech
- DyWorld
- DyWorld-Dynamics
- DyWorld-Dynamics 2
Active since Factorio 0.6

Post Reply

Return to “Not a bug”