Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Trouble with a slider and a button

A topic by Landrik7 created Apr 01, 2025 Views: 160 Replies: 2
Viewing posts 1 to 3
(3 edits) (+3)

Hi everyone ! 

I’m having trouble with a slider. Inside this slider I have a script that is being called with this event  :

on change do
…
end

basically it just changes some field texts based on its own value

It does perfectly the thing that it is meant to do when I use this slider directly.

The thing is that I have a button that modifies this slider.value, and when I click on the button, the value of the slider is changed, but the script inside the on change in the slider is not called.

this is the script that is called when I click the button :

on click do  
    slider1.value: slider1.value-1 
end

Plus, when I try to call directly the function of the slider, if I do for example :

slider1.change[]

inside the button, nothing happens either.

What am I missing in all this ?

(+3)

It seems like you got it figured out, you just needed an example of how to write it.

As you noticed, the "on change do" event handler inside the slider will usually only trigger when it's clicked/interacted with directly.

So here's an example of how to cause the "change" event to happen from inside a button script:

on click do
 slider1.value: slider1.value-1
 slider1.event["change" slider1.value]
end

Hopefully this gives you what you needed. Looks cool!

(+2)

Thank you so much for your answer, I'm going to try it right now !