Setting slider min and max to same value breaks object

I accidentally set a slider object’s minimum and maximum values to the same value. The slider’s thumb object was no longer restricted and it displays what I’m assuming is the default label text “It displays the value when it changes.”

ScreenRecorderProject37

1 Like

It’s a bug for sure, but why would you want to do that?

As I said, it was an accident. I meant to use -100 to 100 but I forgot the minus sign. Yes, I can’t think of a situation but I’m sure there might be a case where you’re adjusting the min and max in relationship to something else. In that limited situation, it should remain locked in place. A bug is a bug.

Yea just a statement, but it’s a funny bug for sure lol

1 Like

Yeah, I was confused when it happened. Luckily, I happened to notice the matching values right away. Otherwise, I could’ve been staring at it for a while. I probably would’ve restarted the app or deleted the object and then added it back.

EDIT: after analysing my situation it is actually the same issue (I forgot I dynamically recalculate and update the slider’s max value and it overwrites initial setup). So, when min = max it breaks the slider.

Actually, this happens to me when the max value is reached as well (e.g. minimum value set to “0”, while max value to “10”). So I’m bumping this bug.

image

and I dont know how to stop it from breaking, because once it does, it wont go back to its place, unless the value is reduced to less than max and player try to change its value again (then it jumps back to the “rails”)

What are you setting the min and max to?

This is initial set up, however, I have a variable “MaxCapacity” which controls max value of each slider (but this shouldnt matter).
In my example above I set the “MaxCapacity” to “10” (which is indicated by the red resource bar on the right of the slider).
Minimum value is set at “0”

Is the min ever equal or greater than max?

EDIT: perhaps YES under my specific conditions (action makes a calculation and sets its new max to 0 which is also the minimum). Let me explain:

In my example above I tried to disallow the ability to drag the slider when the “stock” is at predefined maximum value (controlled by a variable).
So, although the slider max value is set to 10, when the stock also =10 then it should not be able to increase its value/be dragged.

I “zero” the slider after buying action takes place, so despite the slider being at “0” value it gets blocked because its maximum value changes to 0 due to this action:

I set values of sliders to 0 when player buys items… (it works like that so when the player goes back to the shop, then all the sliders are se to 0 (blank). Otherwise, it will move items from the previous shopping session to the new shopping cart…
Maybe I need to find a different way of achieving that, without the calculation that I have in place, which dynamically changes max cap of the slider.

See my code below to illustrate what Ive done.

Sorry for the confusion, while replying I figured it out and edited my response multiple times. So yes, min = max, and it is the same case as yours (although not by a mistake but on purpose via various actions, conditions and dependencies).

OK. I’m going to report it through the extention report feature. In the meantime you could probably use 2 events.

enable interactions when min<max

Disable interactions when min = max

Edit: I just filled a GitHub error report

https://github.com/4ian/GDevelop/issues/6695

1 Like

Thanks for the advise and report.

I managed to nicely combine my idea with what you suggested: (just had to add object variables “IngredientName” to the sliders in order to pull it off)

image

1 Like