Space Engineers

Space Engineers

318 ratings
[PARK] Piston And Rotor Keybinds
5
2
4
2
3
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
430.640 KB
9 Dec, 2019 @ 5:50pm
30 May @ 3:45pm
16 Change Notes ( view )

Subscribe to download
[PARK] Piston And Rotor Keybinds

Description
This is a script intended to make things like cranes simpler and easier to control. It allows you to control rotors and pistons using movement commands through a cockpit. As a result, you can have four six axes of control, per profile (which I will explain a bit later).

This makes this script useful for things like cranes and possibly rotor based tank steering, although it could potentially be used for anything you want keybind controls for.

Update 1.3.0:
Another minor update adding in the setting "toggleRotorPower". Does the same thing as togglePistonPower, in case your build is really jiggly for some reason and want to be able to toggle off the rotors automatically.

Update 1.2.9:
Minor update adding in the setting "togglePistonPower" to only enable pistons for when they are moving. defaults to off in case you want to manually enable/disable pistons, but may reduce the noise pistons make while stationary if enabled.

Update 1.2.5:
Added return to zero functionality.
Three new terms have been added to the generated ini files, Return Position, Return Speed, and Return Order Priority.
When you run the command "Return", it will return each part to the set position, provided it has a speed set, in the order of the lowest Return Order Priority first.

If you set the Return Order Priority to -1, it will cause parts to return to their neutral position whenever their input isn't being received, and won't be considered when executing the return command.

Update 1.2.0:
Added in support for mouse controls with help from Marii. Now you can control your end effectors more... effectively.

Added in ramping so you can tap control things, as well as a general speed multiplier you can define with commands. With both of these it should be a lot easier to make small, precise movements.

Setup is surprisingly easy, even for how I predicted it to be.

1) Put all the rotors, pistons, and ship controllers in a group called "PARK" (You can change this in the script.)

2) Compile the script for the first time. It may give some warnings if the controllers have thruster or wheel control enabled. This does not prevent the script from running.

3) Go into the customData of the blocks and you will find something similar to this:

;Provide the RPM of the part when the corresponding key is pressed.
[PARK:Main]
Forward=0
Backward=0
Left=0
Right=0
Up=0
Down=0
Roll Left=0
Roll Right=0
Pitch Up = 0
Pitch Down = 0
Yaw Left = 0
Yaw Right = 0
Return Position=0
Return Speed=0
Return Order Priority=0

Each of the values represent movement commands that can be read through the cockpit. When the corresponding key is pressed, it adds the corresponding value to the velocity of the part. This is additive, it will sum up the total value and apply that value to the part. For rotors, it is RPM, for pistons, it is M/S, for suspension, it is the throttle ratio.

For example, if you want a rotor to turn clockwise when you press forward, and counterclockwise when you press backward, then you just need to set "Forward=[a_positive_value]" and "Backward=[a_negative_value]".

By default, the script ramps up in speed until it hits the defined speed over 3 ticks. This should make fine adjustments easier. You can change this at the beginning of the script.

Thanks to a recent addition added in by Marii, you can also use mouse controls to move components run by PARK.
The last four settings correspond to that.

Recently, I added in Return Angle, Return Speed, and Return Order Priority.
If you run the command "Return", it will return to the angle set, at a set speed, prioritized lowest first.
So if you want a part to return to 15 degrees at a speed of 2 RPM after the first set of the controlled parts moved, then you can do:
"Return Angle=15"
"Return Speed=2"
"Return Order Priority=1" (0 goes first, 1 is second.)
Setting Return Order Priority to -1 causes the part to return to neutral positon immediately after control is released.

Set this up as desired.

4) Recompile to get the script to recognize changes.

(Optional) The script allows you to set up multiple profiles. To add a new profile:

5) Go into the customData of the programmable block. Add the name of the new profile on a newline.

For example, the initial pregenerated profile should look like this:

"Main" (The actual value contained within quotation marks.)

And to add a new profile to it could make it look like something like this:

"Main
Secondary"

There is no rule that says you must add them one at a time.

6) Recompile the PB to get it to recognize changes. The PB will take the new string and use it to generate a new section in each block. This will appear similar to the the first example, but incorporating the name of the profile you just defined.

7) Set up as normal.

Commands:
"enable" Lets the script read commands from the cockpit.
"disable" Disables the cockpit from reading commands from the cockpit. The script will stop movement if it is moving.
"toggle" Toggles between the enabled and disabled states.
"return" Returns the parts to the defined zero position provided they have a return speed.
"mult <ratio>" sets the multiplier that effects the speed of configured parts. "mult 2" would double speed, for example.

Anything other than the above will be considered a command to switch profiles.
For example, typing "secondary" would cause the script to attempt to switch to that profile, and gives a warning if no such profile exists.

Note, the commands are not case-sensitive, at least for now.

Footnote:
I have noticed that often when people set up cranes in survival they usually just use clunky terminal options to actuate things. I hope that this system at least allows you to set up your cranes with more natural controls. I created this script to make it easier to control cranes without being all that much more difficult to set up. I hope you find this script useful.

TODO:
0) Not sure, feel free to leave suggestions for me.
Popular Discussions View All (3)
4
20 Jun, 2024 @ 10:32pm
Runs, but does not create the sample "Custom Data" info in the instructions
GrumpyGoblin
2
31 May, 2024 @ 10:42am
Exception, then initialising
Edmund Bestoiber
3
3 May, 2023 @ 4:35pm
Exception caught
Gemini Sierra
215 Comments
Trekki  [author] 22 Oct @ 6:23pm 
The groups do have to have unique names or they can interfere when initializing. But it does seem I messed up the error message for it.
TheAmazingPaulrus 22 Oct @ 7:21am 
Aaaand as suddenly and inexplicably the errors came, they're gone now. What worked for me, and I have no idea why, is changing the group name (and reference in the script) to PARK2 and no more errors? Wish I could shed more light on it for others having issues, but I have no idea what fixed it for me.
Leconite 21 Oct @ 5:10pm 
Interesting, I used PARK to deploy and park multiple solar collectors on a large grid ship in single player with no errors.
Hope this info helps you track down the issue.
TheAmazingPaulrus 21 Oct @ 4:08pm 
Well, now, that's something I can try. I guess that was another variable, it was on a static large grid in my SP save, but in MP it was on a large ship that was docked to a stationary large grid station. After testing just now, It does seem to work with my large grid static base, just not the large grid ship docked to it.
Trekki  [author] 20 Oct @ 9:31pm 
I am really unsure what is going on, tbh. Is it specifically broken with static grids?
TheAmazingPaulrus 20 Oct @ 6:19pm 
Here to add that I too am getting the yellow text about /r, /n, , error on large grid. Specifically, however, on my dedicated server. Seems to work fine on large grids on my single player save.
LUCASUS 1 Oct @ 5:37pm 
It works on a small grid crane but I get the same /r, /n, , error. with large grid.
shermanrogers 26 Sep @ 3:51pm 
Tried to add a crane to our base... failed.
I have been using PARK for awhile now and felt confident i could get this crane to work.

built the crane on our survival server and installed the script into a PB and got yellow error messages when compiled.
started a solo game built the same crane installed the script and it works perfectly.

complete loss as to whats happening.

getting the /r, /n, , error.

Please help me understand what the issue is.
Festive Gears 14 Sep @ 3:08pm 
works fine for me, first time actually using it after having it in my arsenal for a while was after the apex update. Only issue I've had was my return argument occasionally not working but that may be due to me (I run with "Return" as the argument from hotbar, it'll do some things then seemingly get stuck on something for a while then finally work. Not 100% sure what the root cause is but might be something to do with my setup.)
Trekki  [author] 10 Sep @ 1:53am 
Did you remember to add them into the group?