Page 1 of 1

Make a sprite button display the number 0

Posted: Thu Mar 21, 2019 10:26 pm
by Therenas
Currently, a sprite button can show a number in it's bottom right corner, by setting the number attribute on the gui element. However, when setting it to 0, the button displays nothing. I propose that there should be a way for the button to display 0, as it is useful in certain scenarios.

For example, when you use the button to show the amount of an item being produced, you might want to show that there is currently 0 items being produced. If the button doesn't show a number at all, the user might be confused as to why, and might think that the number is simply missing, instead of deducing that it has to be 0. It would be much nicer if it said 0 on the button.

Now the ability to show nothing should be preserved of course. This might be resolved by passing nil as the value for the number attribute to indicate no number should be displayed (not sure if that is feasible) or by having a boolean flag such as show_number to indicate the intent of the modder.

Re: Make a sprite button display the number 0

Posted: Wed Apr 24, 2019 6:36 pm
by Boodals
I implemented this a while ago (I have source access), and it was accepted into the latest version of 0.17.

Re: Make a sprite button display the number 0

Posted: Wed Apr 24, 2019 8:35 pm
by Therenas
Awesome, thanks!