Space Engineers

Space Engineers

Cockpit Piston, Rotor & Hinge Controller
251 Comments
Caazego 10 May @ 10:55pm 
@bowan if you subscribe to the script then search your game installation drive for "1760157651" you will find a directory. Open the file Script.cs in that directory and you can do the copy/paste yourself.
Bowan 3 May @ 2:50pm 
can someone copy paste the entire script please its not allowing me to upload the script in my server even though I have them enabled.
Naix 16 Jan @ 9:28am 
//Block/group names (eg. "Piston 2"), leave empty (eg. "") to disable that output
string AD_Name = "Crane Hinge Wrist 3"; //Name of A & D Block / Block group
string WS_Name = "Crane Pistons Forward"; //Name of W & S Block / Block group
string QE_Name = "Crane Advanced Rotor Wrist"; //Name of Q & E Block / Block group
string SpaceC_Name = "Crane Hinge Wrist Middle"; //Name of Space & C Block / Block group
string MouseX_Name = "Crane Advanced Rotor Rotate"; //Name of MouseX/LeftRight Arrow Block / Block group
string MouseY_Name = "Crane Piston Support"; //Name of MouseY/UpDown Arrow Block / Block group
Naix 16 Jan @ 9:28am 
//Speed multipliers - negative values invert direction
double AD_Movespeed = 10.0; //A & D speed multiplier.
double WS_Movespeed = -2.0; //W & S speed multiplier.
double QE_Movespeed = 10.0; //Q & E speed multiplier.
double SpaceC_Movespeed = 2.0; //Space & C speed multiplier.
double MouseX_Movespeed = 0.1; //MouseX speed multiplier.
double MouseY_Movespeed = -0.1; //MouseY speed multiplier.
Naix 16 Jan @ 9:28am 
For me is Working very nice :D
"reverse mouse is fixed :D" you just need to reverse double Mouse X and Y and string mouse X and Y.
MrXSmiles420 8 Jan @ 8:15pm 
To add below you can not individually rev the mouse axi and the up down left right keys. pretty sure the axi is base on those keys as well
MrXSmiles420 8 Jan @ 8:11pm 
Flawless absolutely what was needed. For those who cant get it to work you need to name each (joint) rotor hinge ect. then go into the scrip and insert the names in between the "" example

Correct:
string AD_Name = "base rotor"; //Name of A & D Block / Block group
string WS_Name = "Hinge"; //Name of W & S Block / Block group
string QE_Name = "Pistons2"; //Name of Q & E Block / Block group
string SpaceC_Name = "Pistons"; //Name of Space & C Block / Block group
string MouseY_Name = "neck"; //Name of MouseX/UpDown Arrow Block / Block group
string MouseX_Name = "Hinge3"; //Name of MouseY/LeftRight Arrow Block / Block group
string BN_Name = ""; //Name of B & N Block / Block group
MrXSmiles420 8 Jan @ 8:11pm 
The name of the peace your trying to control should go where empty name is. now in the script it doesnt say empty name you will see "" simply click inbetween them and enter the name you named your part too. now if the spelling is wrong the entire script wont work.
MrXSmiles420 8 Jan @ 8:11pm 
string AD_Name = "empty name"; //Name of A & D Block / Block group
string WS_Name = "empty name"; //Name of W & S Block / Block group
string QE_Name = "empty name"; //Name of Q & E Block / Block group
string SpaceC_Name = "empty name"; //Name of Space & C Block / Block group
string MouseY_Name = "empty name"; //Name of MouseX/UpDown Arrow Block / Block group
string MouseX_Name = "empty name"; //Name of MouseY/LeftRight Arrow Block / Block group
string BN_Name = ""; //Name of B & N Block / Block group
MrXSmiles420 8 Jan @ 8:11pm 
As to questions of adding more buttons unfortunately its not doable being the key binds are based of ones that are considered movement binds inside the game. so theres no way to add more unless the devs randomly decide to expand that. wich they wont.

There is a question of controlling two hinges with one setting im going to experiment with that using two programable blocks and running the script twice with different settings . maybe even a second control console.
MrXSmiles420 8 Jan @ 8:10pm 
hi
MrXSmiles420 8 Jan @ 8:10pm 
hello
MrXSmiles420 8 Jan @ 4:38pm 
How would i add more key bindings to the script to extend the use ???
Jay 26 Dec, 2024 @ 1:48am 
looking for an updated version where a group can control different blocks. Example. One design im working on is an arm that has the same joint movements as a human arm. this means it has a a rotor and hinge for the shoulder, elbow, and wrist. a camera on the end for viewing and aiming with mouse control is the end game of this and several other ideas. if you make an updated version where such control is possible, or can point me to another script that has this capabilities, it would be greatly appreciated. Thank you so much.
Bash 14 Dec, 2024 @ 8:03am 
Just tested this as of 14DEC24 it doesn't work, if someone gets it to work lemme know
LobitoLoco 15 Oct, 2024 @ 4:10am 
Just tested, works fine with the Version following Contact DLC
Poody 10 Sep, 2024 @ 6:20pm 
Is this broken now? even after labeling everything right it just acts like it doesn't want to recompile and change any edits. Can only seem to get it working by putting down a fresh Pb and copy pasting into it. any changes after are not read it seems.
Barbatos 3 Jun, 2024 @ 2:12pm 
Is it possible to change the mouse movement to only use the arrow keys?
Into 9 Apr, 2024 @ 6:38pm 
Using Mouse X-axis and controlls are for mouse and arrow keys reversed. Mouse goes up and arrows goes down or with "rev" the other way around. How do I rev mouse, but not arrow keys?
telepath 17 Mar, 2024 @ 8:00am 
Awesome, quite simple, everything you need for an arm or a crane! Love it.
zap_death 12 Feb, 2024 @ 11:20am 
i just decided to spawn it in after building ig
zap_death 12 Feb, 2024 @ 11:15am 
i cant find what to name the pistons or its just not finding even with name
KARASUMI 6 Jan, 2024 @ 3:55am 
Is it possible to return or set it to any position when I let go of the key operation or when I leave the cockpit?
Mandagor 19 Dec, 2023 @ 11:40pm 
Thank you very much.
This script is a must have :)
Tekk  [author] 18 Dec, 2023 @ 1:09pm 
Near the top of the script, there is a line:
string Controller_name = "Cockpit";

Change Cockpit, to the name of the cockpit you want to use as crane :)
Mandagor 17 Dec, 2023 @ 6:08am 
Hi, got a little problem with the script. On my truck i have 2 cockpit. The driver one and the crane one. I can move the crane when inside the driver cockpit but i cant move the crane when i a nside the crane cockpit. Why ? can i change this ?
KTKillo 25 Sep, 2023 @ 8:59am 
@Phoenix, just realized it! Thanks a lot!
(Silly me...)
Phoenix 25 Sep, 2023 @ 7:22am 
@KTKillo For scripts, you load them into individual programmable blocks. Access the pb you want to use, then hit the 'edit' button and then 'browse scripts.' Any scripts you're subbed to should appear on that list after a few seconds.
KTKillo 25 Sep, 2023 @ 5:56am 
Hello,
I'm not able to launch it... :(
I'm suscribed here, and the option "Script in game" is checked.
Even do, when I try to activate it, I don't see the script in the mod list menu
What I'm missing?
Thanks in advance
Tekk  [author] 30 Aug, 2023 @ 9:22am 
Right I think I see where the misunderstanding is happening:

In the video, Syberiah has a diagonal piston at the bottom.
The two hinges connected to that needs their torque at 0, as they're being used like *actual* hinges rather than something to be controlled.

Hinges that you want to control, do need torque values to operate :)
th3_undying 29 Aug, 2023 @ 4:16pm 
Disregard my last comment. While the video says to set all hinge torque settings to ZERO, that particular hinge absolutely NEEDS to have torque values so it can operate properly.
th3_undying 29 Aug, 2023 @ 4:12pm 
I just found a tutorial using this script on Youtube and I was able to recreate it with no problem. However, one of the parts is unresponsive-a limp noodle- and I followed the video to a T.
https://youtu.be/_AIpcmI8IQI?si=SCPqCit9h-VoggOc is the video in question so someone can reference. The Hinge Wrist part is the one that isn't working at all.
Tekk  [author] 24 May, 2023 @ 11:26am 
Very curious why it's behaving like that; Fundamentally it's just looking at the cockpit and whether the occupant is trying to move somewhere, and acts on that.
Any chance you could try it without mods? See if there's a conflict (or maybe the game is limiting the PB when sharing resources between it and mods?)
Tiger 23 May, 2023 @ 6:32pm 
Other than that glitch, that world is running normally. It has a lot of mods, but they didn't affect your script when I initially tested it. I'll have to try building the drill contraption on a different ship and see if it does the same thing again. Maybe try remapping it to another axis...

There's no visible reason why it would be treating a long key press as if it were just a tap. No Clang, no obstructions, no piston limits... it's literally sticking out of the side of a cargo ship in open space, but it won't move more than a nudge. I'm an ancient veteran of the game, so I'm pretty sure this one isn't user error. Blame it on Keen, I suppose.
Tekk  [author] 23 May, 2023 @ 5:15pm 
Sadly not, Keen hasn't given any access to actual button inputs via scripts; This uses the movement inputs that the cockpit "sees".

@Tiger Weird! I haven't experienced that or heard of it before; How does the game run for you otherwise? high/low FPS? Ever get reductions in Sim speed?
NyxEline 23 May, 2023 @ 11:36am 
is it possible to add more hotkeys? like mouse left right maybe even mouse scroll?
Tiger 22 May, 2023 @ 6:33pm 
I tried both those things, and also tried moving the ship far clear of any asteroid's bounding area. Still glitched.
NyxEline 22 May, 2023 @ 1:23pm 
stupid me didnt realize i need to not have anyother name in there ONLY the new name it has been given :)
NyxEline 22 May, 2023 @ 12:40pm 
it has a diffrent name but stil didnt work?
Tekk  [author] 22 May, 2023 @ 12:40pm 
Make sure each cockpit has a unique name, and that the name is put in the config (top of script) of the PB you want it used with
NyxEline 22 May, 2023 @ 12:21pm 
Hello Love the script!. iam currently running two Programmable blocks one for one crane and and for another however the script wont seem,to notice the other cockpit?
Tekk  [author] 22 May, 2023 @ 8:52am 
Two things you could try:

Disable piston acceleration, this is done by (at the config section at the top of script) setting
bool Use_Piston_Acceleration = false;

Second thing is trying to change the "Max Impuls Axis" and/or "Max Impluse NonAxis" values on the piston itself.

If neither works, I think it may be some game glitch, maybe related to the amount of stuff going on at the mining site?
As long as the controller (cockpit/seat/remote) is occupied and a movement key is pressed, I can't see anything script wise that would make it stop
Tiger 22 May, 2023 @ 12:47am 
I've run into a strange glitch: movement is no longer smooth for pistons. My very simple arm involves a rotor for lateral swing, a hinge for vertical swing, and a piston to push straight out from the hinge, with a drill on the tip. The rotor and hinge are set to matching mouse movement, and the piston is the WS axis.

It worked the first time I tested it in drydock, with smooth movement. As as soon as I moved my new ship up alongside the mining site, the WS axis started moving 10cm and stopping with each key press, not continuing anymore. From then on, it's permanently bugged like this. I've totally rebuilt the rig and the programmable block, reloaded the script, reloaded the world, tinkered with the piston force settings, experimented with inertia tensor, and near as I can tell the problem is with the program doing something weird. Any ideas?
PATS3Y 6 Apr, 2023 @ 6:59am 
how do I setup two rotors to forward and reverse for a motor bike i'm working on?
FlyingAvocado007 22 Feb, 2023 @ 9:38pm 
Ok, after many hours of troubleshooting, it looks like with the second crane it REALLY didnt like when the names of items were changed, so I removed all the blocks and rebuilt it while only changing the support piston name and it now seems to be working.
FlyingAvocado007 22 Feb, 2023 @ 8:21pm 
Interesting, so it seems that your right about the controllers. The original crane's cockpit seems to have (most) control of both cranes. The only thing it cant control on the 2nd crane is the Y mouse axis, which I have set as the lower support piston. Although thats something on my end because I cant even move it manuelly using the control panel. As I said before, there aren't any duplicate named things. I've tried tearing down and replacing the PB's and cockpits, which after doing that for the original crane it inverted the mouse controls, haven't figured that one out yet. I think the next thing to try is tearing down the whole crane and building it again. Not sure what it would fix, but maybe its worth a shot.
Tekk  [author] 22 Feb, 2023 @ 2:31pm 
I rekon it would be one of two things: Either the controllers for the two cranes do not have unique names (eg. 2 x Cockpit), or it may be a station/grid thing; Some patches ago, stations wouldn't transmit move/rotation indicators to clients, in multiplayer. May be that there is a similar thing where two controllers being on a stationary grid, only one will give an output.

Could be a third thing, but I'd need more info about Blocks, groups and controllers definitely having unique names.
FlyingAvocado007 21 Feb, 2023 @ 9:15pm 
Hi, have you ever had problems with having 2 cranes on the same grid/station? My first one works great, but I cant seem to get a response from the second one. I cant find any differences in the 2 other than that the respective parts for each crane are named slightly different. TIA
Tekk  [author] 11 Feb, 2023 @ 12:40pm 
I do not think it was!
Always used both X and Y during testing, so didn't really show up.

You indeed found part of it, similar issue a bit further up made the two problems basically swap X and Y (If only one of them existed, it would have thrown an error, irony huh)

It's fixed, I have also swapped X and Y (intentionally this time) to maintain original behavior, apart from the Movespeed factors actually affecting the correct axis' now.

Might take a tick for the script to be updated by steam.

Appreciate the feedback :)
Fallen011[35] 11 Feb, 2023 @ 11:15am 
I do not know if this was reported already. Could not find anything mentioning it.
There is a small, issue with the script.

"MouseY_Movespeed" and "MouseX_Movespeed" are the opposite to each other.
So, "MouseY_Movespeed" will change the block/group from "MouseX_Name" and vice versa

MouseY_Movespeed <--- Is actually the MouseX_Movespeed
MouseX_Movespeed <--- Is actually the MouseY_Movespeed

And it makes the changes of the "MouseY_Name" to "MouseX_Name", and vice versa.

I do not know if this has to do with it, but just saw this.
https://imgur.com/HeBDmgI

Else, this script works great and had saved my build.