Forum rules - please read before posting.

Slider Issue

I created a custom variable that is controlled by a slider with eight steps. The variable starts at 200 and ideally, every time the player slides it up or down it increases or decreases in increments of 25. However, when I click on the slider, the value of the number keeps going down; while the mouse button is pressed. Is there a way to have the value change only when the player is dragging the slider? I have tried creating an action (Input->Check->Button>Single Click or Tap) and this works to stop the value from decreasing while the mouse button is being pressed but the slider then has no effect. Any help would be appreciated. Thank you in advance.

Comments

  • In which versions of AC and Unity?

    I'm afraid I can't recreate such an issue. Certainly you shouldn't have to rely on any Actions - you're saying the slider value decreases even while the mouse isn't moving?

    I'm assuming you're not using Unity UI for this, since only AC-based sliders have a "steps" property. Please let's see some screenshots to help understand what the issue might be.

  • Thank you for the quick response. Here are some screenshots. The first one is the normal starting position of the slider. The second one reflects that when the mouse button is being pressed while over the slider, the number is going down. The third one has the slider dragged down and the number at a lower value. My formula is simply 200-25. I understand why the value keeps going down. What I would like to do is have the value go down according to the slider position (or fill bar) and to not go down when the mouse button is being pressed (held down). I hope that clears it up for you. Apologies if I wasn't clear enough.

  • Also, I am using AC version 1.67.5 and Unity version

  • To be more exact, what I want to do is have the price per lb number go down or up according to the slider.

  • Sorry, I'm not clear on this. You mention a formula, but where/when/how is this used? If you don't want the slider to go down when the mouse is held, when should it change? Please break things down as clearly as you can - with screenshots showing the settings/properties/actionlists, not just the final result.

    If you don't want the slider to be interactive, uncheck User can change value? in its properties.

  • I will try my best to explain the situation. Currently, whenever the player interacts with the slider and presses on it (and keeps mouse button held down), the ActionList:PriceChange kicks in and the number(var:3) starts to decrease by increments of 25. I understand why this happens and its because as the player is holding down on the slider, the formula will keep on running.

    I want the number to be controlled by the slider but I want the formula to stop running if the mouse button is held down. I would also like it if the number was in accordance with the "step" on the slider e.g. Slider has a max value of 200 and consists of 8 steps, on step 8 number is 200, step 7 number is 175, step 6 number is 170 etc. As the steps go down, the number is decreased by 25.

    I hope this helps to clear things up. Apologies, for not being more exact. Thank you for your patience.

  • The slider isn't linked to anything - so unless you're reading its value through script, its state won't have any meaning. You can link it to one of your Global Variable - but it'll need to be a Float variable. Integer variables can't be linked, even if the only values the Slider can have are whole numbers (which should be true this case).

    If you change "Marijuana Price" to a Float variable (though I should say, I'm not sure if this is exactly what you want to control with the slider), then you can change the Slider affects field to Float Variable and select it. That'll cause it to only take the stepped values set by the slider (0, 25, 50, etc).

    You won't want to use a formula to control the same variable that's linked to the slider - instead, have this affect a different variable so that the slider value, and the one that's this minus 25, are separated. This'll give you more control over things, and you can always instead link the Slider to an "intermediate" variable that's just used in the formula.

    I'm still not clear on your intent behind the formula to not run if the mouse is held down. If the value isn't changing - what's the issue there? Bear in mind that this ActionList should be set to run in the background so as not to interfere with the mouse clicks.

  • Thank you for the explanation. Will try to figure it out.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.