Slider value question

Just started using Construct 2? Post your questions here

Post » Sat Oct 21, 2017 11:44 am

Hi everyone,

Is it possible to set up a condition where slider value is changed by +1 or -1 instead of just equal to or more/less than a certain number. There is an option which says 'on changed', but there is no value to enter with this one.

At the moment I've set up dummy conditions where slider value goes up by 200 up to a maximum value of 1000, and each step it changes the temperature of the engine.

The only thing I can think of is making 1000 events for each number from 1 - 1000 to alter the temperature.

Thanks for any help.

Obi
B
7
Posts: 37
Reputation: 353

Post » Sat Oct 21, 2017 12:32 pm

Not sure I understand your question.
I made a little demo, hope it helps.
https://www.dropbox.com/s/6qyxgl8y1hcgl ... .capx?dl=0
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
126
Posts: 1,761
Reputation: 67,343

Post » Sat Oct 21, 2017 1:03 pm

Hey @Obi554!

I didn't understand exactly what you'e trying either.

When you change the slider, it will adjust its value to the value corresponding to the current position of the slider on the bar in relation to max and min values. So, if you have a slider with min 20, max 100 and step 10, you'll have a slider with 9 possible positions and you can change from each to any other of them. Sliders are not used to increase something step-by-step.

You can force the slider to only go up or down one step at a time, but I wouldn't recommend, since it feels very weird and counter-intuitive. Another option would be to use the slider just as a feedback object, instead of an input object, and control its values with buttons. But, again, I'm not sure what you're trying to acomplish here.

The capx below has both situations I explained above. The first slider let's you change it, but limits the change to one step up or down. The second one doesn't let you interact directly with it, but, instead, is controled by the buttons.

https://www.dropbox.com/s/2ej7ti9kb9phh ... .capx?dl=0

Hope this helps. Cheers!
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
22
S
6
G
3
Posts: 717
Reputation: 3,996

Post » Sat Oct 21, 2017 1:42 pm

Message: Obi554 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
dop2000 wrote:Not sure I understand your question.
I made a little demo, hope it helps.
https://www.dropbox.com/s/6qyxgl8y1hcgl ... .capx?dl=0


I'm unable to open your file in my version of construct: 244.

I downloaded and installed the beta release: 247 but now it doesn't allow me to load the run layout using chrome, as I get an error message.

Are u able to save the project so it's compatible with 244? I think i'm gonna downgrade.
B
7
Posts: 37
Reputation: 353

Post » Sat Oct 21, 2017 1:48 pm

Here is the file for version 244:
https://www.dropbox.com/s/no1fe3ln9rp2g ... .capx?dl=0

You can change the browser used for preview in project properties. If it doesn't work in chrome, try another browser.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
126
Posts: 1,761
Reputation: 67,343

Post » Sat Oct 21, 2017 1:51 pm

Message: Obi554 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
brunopalermo wrote:Hey @Obi554!

I didn't understand exactly what you'e trying either.

When you change the slider, it will adjust its value to the value corresponding to the current position of the slider on the bar in relation to max and min values. So, if you have a slider with min 20, max 100 and step 10, you'll have a slider with 9 possible positions and you can change from each to any other of them. Sliders are not used to increase something step-by-step.

You can force the slider to only go up or down one step at a time, but I wouldn't recommend, since it feels very weird and counter-intuitive. Another option would be to use the slider just as a feedback object, instead of an input object, and control its values with buttons. But, again, I'm not sure what you're trying to acomplish here.

The capx below has both situations I explained above. The first slider let's you change it, but limits the change to one step up or down. The second one doesn't let you interact directly with it, but, instead, is controled by the buttons.

https://www.dropbox.com/s/2ej7ti9kb9phh ... .capx?dl=0

Hope this helps. Cheers!


Hi,

Thanks for your detailed message :)

What I want to be able to do is:

When I change the slider value, it will directly alter the value of another separate dependant variable. So if my min and max are 0 - 1000 on the slider, I would like to be able to move it in the smallest possible increments so I can get a really cool changing of values on the dependant variable.

So far (i'm a complete beginner), the only coding I understand and am able to achieve is the following:

If slider = number > make other variable value = number

I'd prefer something like:

If slider goes up by x > make other variable value go up/down by x
B
7
Posts: 37
Reputation: 353

Post » Sat Oct 21, 2017 1:51 pm

Message: Obi554 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
dop2000 wrote:Here is the file for version 244:
https://www.dropbox.com/s/no1fe3ln9rp2g ... .capx?dl=0

You can change the browser used for preview in project properties. If it doesn't work in chrome, try another browser.


Thank you so much!

Will test it out and get back to you.
B
7
Posts: 37
Reputation: 353

Post » Sat Oct 21, 2017 1:52 pm

Message: Obi554 can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
dop2000 wrote:Here is the file for version 244:
https://www.dropbox.com/s/no1fe3ln9rp2g ... .capx?dl=0

You can change the browser used for preview in project properties. If it doesn't work in chrome, try another browser.


Sorry I don't use Chrome, I meant Mozilla. :? :)
B
7
Posts: 37
Reputation: 353

Post » Sat Oct 21, 2017 1:56 pm

Just change the Preview Browser to Firefox then. It's in project properties.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
126
Posts: 1,761
Reputation: 67,343

Post » Sat Oct 21, 2017 2:41 pm

If slider goes up by x > make other variable value go up/down by x

You can get the slider value at any time with the expression SliderBar.value
I'm using it in my demo to output temperature as text, you can assign it to a variable or use in formula.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
126
Posts: 1,761
Reputation: 67,343

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest