Profile image

Button/Switch Interaction Types

10.6k Timplanes  2.6 years ago

Ok… So the “Continuous” interaction type is supposed to set a variable to the specified value while the button is pressed right?
But, for some reason it isn’t working for me. It ends up working the same a “Once” and sets the variable to the specified value and it stays there even after the switch is un-pressed.
Am I doing a stupid or is this a glitch?

Here’s an Example Craft

  • Log in to leave a comment
  • Profile image

    @PlaneFlightX
    This saved me from an additional 30 minutes of pain. Thank you.

    +1 one month ago
  • Profile image
    10.6k Timplanes

    @PlaneFlightX
    Thanks, that’s very helpful!

    +1 2.6 years ago
  • Profile image
    49.5k PlaneFlightX

    There is nothing wrong with what you did, but let me explain how the three work.

    Once sets the variable to outputValue every time you click it, ignoring the time you hold it down.

    Toggle works as expected, allowing you toggle the variable between outputValue and 0.

    Continuous sets the variable to outputValue every time you click it, and will continue to write to it as long as you hold it down. What you forgot is if you set it to 1 using a switch set to Continuous, you need a method of setting it to 0 (The same rule applies to Once). As you do not, it stays at 1. Define a setter in the global variables panel called "Var1" and set it's expression to "0". Try using the switch. The expected behaviour occurs.

    NOTE: Make sure you set the priority of the variable in the global setters to -1. Otherwise it will overwrite the switch and the variable will always be 0.

    +7 2.6 years ago