Stormworks: Build and Rescue

Stormworks: Build and Rescue

Using push buttons to change between three different numbers
I'd like to be able to use two buttons to open/close the ramp on my V-22 Osprey by changing between a negative, zero, and positive number but I'm too much of an idiot to figure it out myself.

How should I set up the microcontroller?
Originally posted by Console:
Is this controller doing what you wish?
https://steamcommunity.com/sharedfiles/filedetails/?id=2052910508

It allows you to switch between -0.09, 0 (default) and 0.3 with 2 push-buttons.

The counter-output is just for debug. :)
< >
Showing 1-15 of 19 comments
Unit 744 Apr 7, 2020 @ 2:17pm 
Well, I could think of a pretty easy way to do it with a LUA script. Push button --> pulse (off -> on) so it only fires once per press, then feed that into a LUA script.

i=0
if [push button] then i=i+1 end
if i==2 then i=-1 end

Then just output the number.

You can change the initial value of i to be -1 or 1, depending what you want to start on. This script will increase i by 1 (-1 -> 0 -> +1) each time the button is pressed. When i=1 and the button is pressed, i will become 2, and the last line then cycles i back to -1.

If you are uncomfortable using LUA, hopefully this still gives you some ideas how you might go about doing it with logic modules.
Ra-Ra-Rasputin Apr 7, 2020 @ 2:26pm 
You can also use the up/down counter to do this exact thing :)

Simply clamp it between minimum value of -1 and max of 1, with increment of 1. Make sure you have toggle to push on the inputs, to ensure it only changes by 1 increment regardless of how long you hold down the button.
L0RD3ND3RII Apr 7, 2020 @ 2:48pm 
I want to be able to alternate between 0.3, 0, and -0.09. Not 1, 0, and -1
Unit 744 Apr 7, 2020 @ 2:52pm 
Originally posted by Ra-Ra-Rasputin:
You can also use the up/down counter to do this exact thing :)

Simply clamp it between minimum value of -1 and max of 1, with increment of 1. Make sure you have toggle to push on the inputs, to ensure it only changes by 1 increment regardless of how long you hold down the button.



'Push to Toggle' not "Toggle to Push." Just so it is clear for OP. <-- THESE ARE LIES.
EDIT: It is actually called 'Pulse.' In particular, the Off -> On setting.

Also, I too thought about the Up/Down Counter, but OP implied he wants it to cycle. As in, one push button cycles -1 -> 0 -> +1 -> -1 -> 0 -> etc.

I am sure you can do this with a counter, and, without having the game open, I do not know if the counter has a reset button he could use to reset it back to -1 when necessary. Even so, certainly possible to do with a counter, just might require more steps to get a nice cycle.
Last edited by Unit 744; Apr 7, 2020 @ 3:40pm
Unit 744 Apr 7, 2020 @ 2:53pm 
Originally posted by L0RD3ND3RII:
I want to be able to alternate between 0.3, 0, and -0.09. Not 1, 0, and -1


Ah, you can still use the suggested methods. Except, instead of outputing -1, 0, or 1 directly, use an equals check:

If number is -1, then output -0.09; if number is 0, then output 0, if number is +1, then output 0.3.

EDIT: Do the above using switchboxes and equals modules.
Last edited by Unit 744; Apr 7, 2020 @ 2:55pm
L0RD3ND3RII Apr 7, 2020 @ 2:59pm 
If this helps, one button increases the number and the other decreases.
The first button goes -0.09 -> 0 -> 0.3
The second button goes 0.3 -> 0 -> -0.09

Just some clarification for you guys

Two separate buttons for two separate functions
Ra-Ra-Rasputin Apr 7, 2020 @ 3:08pm 
Originally posted by Unit 744:
'Push to Toggle' not "Toggle to Push." Just so it is clear for OP.

Nope, toggle to push extremely specifically. It sanitizes any input to a single tick input, and is necessary for sequential, controlled use of an up/down counter.

In the case of separate values, you can still do what i did, and sanitize the -1 to -0.09, and +1 to 0.3 by detecting the number and putting them through an f(x) chip. Although this makes cycling only one way by default (by using reset), and very difficult to handle.

There's also the chance of doing this with tiered numerical switchboxes, but i'm spent as far as Stormworks goes today
Last edited by Ra-Ra-Rasputin; Apr 7, 2020 @ 3:17pm
Unit 744 Apr 7, 2020 @ 3:38pm 
Originally posted by Ra-Ra-Rasputin:
Originally posted by Unit 744:
'Push to Toggle' not "Toggle to Push." Just so it is clear for OP.

Nope, toggle to push extremely specifically. It sanitizes any input to a single tick input, and is necessary for sequential, controlled use of an up/down counter.


Oh yes, I am stupid. It is called 'Pulse.' As punishment, my reply fits in only one line.
Jorg Hammond Apr 7, 2020 @ 4:24pm 
You're honestly better off learning a bit of LUA.

I've been trying to bruteforce this using the logic blocks visual programming language and find myself having trouble connecting the first part (two push buttons cycling from -1 to 0 to 1 to -1 and vice versa) and the second part (if x < 0 output -0.09 else if x > 0 output 0.3 else output 0).

I have a bug because for now I'm adding the results of the counters from each button, and of course it sometimes equals 2 or -2, me dummy.

Almost there. (Is it normal I feel like I'm playing a Zachtronics game?)
Last edited by Jorg Hammond; Apr 7, 2020 @ 4:36pm
Ra-Ra-Rasputin Apr 7, 2020 @ 4:35pm 
Originally posted by Rashtek Frites:
Almost there. (Is it normal I feel like I'm playing a Zachtronics game?)

As someone who held a few (tied) world records in Spacechem, Shenzen I/O and Exapunks on both efficiency, and speed, guess why i'm sensually attracted to the microcontrollers.

And yeah, pretty much agree that it's much easier to do in LUA.
Last edited by Ra-Ra-Rasputin; Apr 7, 2020 @ 4:36pm
Jorg Hammond Apr 7, 2020 @ 4:37pm 
Now I'm fantasizing about a hardcore microcontroller mode where you'd have to build them using components à la Shenzhen I/O...

But that is off-topic, my apologies.

(Oooh, I haven't put a modulo in yet... Okay, now my bugs are getting stranger, time for a break.)
Last edited by Jorg Hammond; Apr 7, 2020 @ 4:42pm
Woe Apr 7, 2020 @ 10:39pm 
Originally posted by L0RD3ND3RII:
I'd like to be able to use two buttons to open/close the ramp on my V-22 Osprey by changing between a negative, zero, and positive number but I'm too much of an idiot to figure it out myself.

How should I set up the microcontroller?

It sounds like you are using a throttle or seat. Just make the min be -0.09 and the max 0.3. The throttle (the throttle is two buttons) makes this easy in its settings. The seat will need to be clamped.
Last edited by Woe; Apr 7, 2020 @ 10:40pm
L0RD3ND3RII Apr 8, 2020 @ 3:56am 
Originally posted by woekin_up:
It sounds like you are using a throttle or seat. Just make the min be -0.09 and the max 0.3. The throttle (the throttle is two buttons) makes this easy in its settings. The seat will need to be clamped.
I want two buttons, not a throttle lever.
The reason is that the throttle is variable but I want to be able to go exactly -0.09, 0 and 0.3 without the other numbers in between

I have used a throttle lever for testing to find the numbers I need but I'm not intending on keeping it. I do know how to change the max and min on throttle levers already
The author of this thread has indicated that this post answers the original topic.
Console Apr 8, 2020 @ 4:51am 
Is this controller doing what you wish?
https://steamcommunity.com/sharedfiles/filedetails/?id=2052910508

It allows you to switch between -0.09, 0 (default) and 0.3 with 2 push-buttons.

The counter-output is just for debug. :)
Jorg Hammond Apr 8, 2020 @ 5:40am 
You still need to make it so that if the count is 2 and you press up, count is set to 0, and if the count is 0 and you press down, count is set to 2 (to follow your scheme of counting from 0 to 2 instead of -1 to 1).

But I learned something from the way you used the switchboxes.
Last edited by Jorg Hammond; Apr 8, 2020 @ 5:41am
< >
Showing 1-15 of 19 comments
Per page: 1530 50

Date Posted: Apr 7, 2020 @ 2:05pm
Posts: 19