Space Engineers

Space Engineers

Control Module - basically key binding for ships
372 Comments
ManedWolf May 8 @ 11:10pm 
Thanks. My VTOL ships are working again now. Took me some headbutts to the wall as I don`t understand anything about programing.
Digi  [author] May 8 @ 9:16pm 
Ah yes this has Dictionary property, it's fixed but it requires PB scripts to be updated by replacing:

Dictionary<string, object>
to
IReadOnlyDictionary<string, object>

it should be only 2 places, one in the field and one in the As<...> method.

I've also fixed the lack of terminal refresh which apparently I broke back in oct 2023 with an inverted check, ops xD
ManedWolf May 4 @ 10:40pm 
Don't know if it's just me, but it doesn't work anymore sinse the may 2 hotfix.
Swann Mar 17 @ 6:41pm 
This is really the best keybinding solution, thank you Digi. Is there any way you could make this a Plugin so we could use it in multiplayer? There are pure scripts available but they don't have as much flexibility.
Djelle Nov 9, 2024 @ 6:37am 
Ahh. I did get the controls to show by ur little refresh trick... In both fields :steamhappy:

You are right that the problem is in my world. I went into Sandbox_config.sbc and moved ur mod to the top of the list, so it will load first (I assume). And that made the double field problem go away. The weird thing is that if I now move it back to the bottom, it doesn't double up anymore.

Thanks for pointing me in the right direction :cozybethesda:
Digi  [author] Nov 8, 2024 @ 7:47pm 
I don't get the duplicated controls so the only difference now I guess is the world.
Can you send your world?

I do get the issue with controls not adding but that is from a lack of realtime refresh, which is a new game bug in 205 (was reported by other modders that have the same problem on their mods).
You can force a refresh by clicking the block again on the left terminal list.
Djelle Nov 8, 2024 @ 3:19pm 
I did try removing the two other mods I had. No change. It could look like this mod was aded two times. Tho I did not do that.
Digi  [author] Nov 8, 2024 @ 3:00pm 
Did you try it by itself? As it sounds like a problem with another mod or it's simply this mod added multiple times.
Djelle Nov 8, 2024 @ 1:59pm 
Is not working anymore. In the blocks menu, there are two of each field. And you can not add the keys u want to monitor.
Digi  [author] Jun 1, 2024 @ 9:11am 
Thanks, I replicated the error with your instructions!
And I found a workaround to fix it. It's weird, game is triggering some terminal code on removed blocks.
ScorchHawk May 31, 2024 @ 5:57pm 
I'm also seeing an error when I paste a vehicle using the example turret control program. I changed the rotor names but otherwise the code should be the same. Not too familiar with C# but the error from the log is here: https://pastebin.com/W4YceFks
Digi  [author] Feb 25, 2024 @ 9:23pm 
It's an error that happened with the code from the mod, software is complicated.

The way to get it off the screen is for me to fix it.
And to fix it I need the error details which are in the file that the error asks you to send :P
Use any text sharing service, like pastebin.com for example.

Normally any error in mod code would crash the game, but I opted for this handler that replaces them with red messages to not be as disruptive as a crash while still letting people know there's something wrong... also catching errors is bad for performance and it can leave the code in an unknown state, so I can't just ignore the error.
Eon Feb 25, 2024 @ 5:27pm 
I've recently gotten into the game, and it didnt happen at first but recent past few days with friends on a server, ive been getting hit with 'Control Module ERROR, report contents of: %appdata%/spaceengineers/storage/655948251.sbm_controlmodule/info.log' in giant red text on screen.

I dont think ive ever even used control module...so not sure whats causing it or how to get this off screen.
Rykarn Nov 13, 2023 @ 5:30pm 
BEUTIFUL MOD LOVE IT THIS IS AWESOME. cant believe it took me this long to find your mod, apparently i was just using the wrong keywords
Digi  [author] Nov 6, 2023 @ 12:31am 
It's the same scope as the game itself, I don't have access to specific devices, only what the game API gives me which is per device type: keyboard, mouse and joystick... and also game bindings.

If neither commands do anything then the mod itself isn't working, if it's added to the world then it's most likely download corruption, see fix: https://github.com/THDigi/SE-ModScript-Examples/wiki/Fix-download-corruption
Rykarn Nov 5, 2023 @ 5:57pm 
hi love the concept, a bit unlcear on the scope. does this work with direct input devices? i dont see them showing up in the drop downs , and nothing happens when i type /cm help in chat
Mister Spaceman Oct 30, 2023 @ 8:03am 
Sure! I just don't know how to go about doing that via steam. Could I add you as a friend and figure it out from there to save your comment section? Have to world set up, just need to export and send it.
Digi  [author] Oct 30, 2023 @ 1:42am 
Can you send that fresh test world? I can't quite tell what's the setup there :}
Mister Spaceman Oct 29, 2023 @ 8:48pm 
Sorry to spam the comments; last one for now:
Created a fresh save with only CM and the weapon mod installed, the bug persists here. Using the "show behavior in hud" feature reveals that CM isn't picking up the input while in the CTC.
Mister Spaceman Oct 29, 2023 @ 3:24pm 
Just to clarify; The CTC is on the UGC, which has no cockpit. The UGC, and CTC by extension are controlled from a remote cockpit via antenna. Should I still be able to control the timers from that remote cockpit? If so, then yeah, it’s a bug. Thank you for the quick reply Digi!
Digi  [author] Oct 29, 2023 @ 2:04pm 
You still need to be in a seat that can control those timers, then you should be able to be in a CTC while in that cockpit and still control the timers... if not then it's a bug =)
Mister Spaceman Oct 29, 2023 @ 11:43am 
Does anyone know of a method to make CM useable from a custom turret controller? I'm making an unmanned gun carriage, and using CM to fire the guns staggered. There's a timer for each of the 2 guns, which fire their respective gun once and start the other timer. Another timer stops both of those. CM Triggers the first gun timer on pressing left click, and the stop timer on releasing.

This works brilliantly from a seat or from the remote control, but doesn't work in the CTC. Is there a workaround? Oldschool gyro turret?
SKY.fungi-guy Oct 23, 2023 @ 7:39am 
Thanks for the quick update, Digi! I'll turn it back on next time I do a server update. :-)
Digi  [author] Oct 23, 2023 @ 2:07am 
There updated, it no longer errors until you actually try to configure it (or it has [ControlModule] in CustomData) + moved errors to a button's tooltip in terminal (only shows up if there are errors).

Hopefully I didn't add any new bugs with all that code shuffling around =)
Digi  [author] Oct 23, 2023 @ 1:01am 
It seems that inventory manager PB script went out of its way to be anti-compatible with the established MyIni format present in PB and mods (provided by the game) by using the --- separator xD

I guess I can remove them from being log&HUD errors to being an error in the terminal, but not much else I can do, I can't ignore these errors, it's up to the player to decide if they even care about this PB to have control module or not.
SKY.fungi-guy Oct 22, 2023 @ 4:12pm 
Myself and a friend are also both receiving the same. dnjuandmrk, did you come to any resolution on this? Here's mine:

[18:56:47] Initialized
GameMode=Survival
OnlineMode=OFFLINE
Server=False
DS=False
Defined=STABLE,
[18:58:34] ERROR: Failed to save settings on 'AgonBase1_PB1_IIM': failed to parse CustomData (before --- divider)
dnjuandmrk Oct 11, 2023 @ 6:05am 
Log contents:

[07:56:00] Initialized
GameMode=Survival
OnlineMode=OFFLINE
Server=True
DS=False
Defined=STABLE,
[07:57:17] ERROR: Failed to save settings on 'Inventory Programmable Block': failed to parse CustomData (before --- divider)
[07:57:55] Unloaded.

I'm running Isy's Inventory Manager on that PB.
Digi  [author] Oct 10, 2023 @ 11:13pm 
What's the error?
dnjuandmrk Oct 10, 2023 @ 7:55pm 
Whatever you changed caused an error when I loaded my save tonight. Game seemed to load fine, but got an error message calling out Control Module. Removed the mod from the list and reloaded, no error.
Digi  [author] Sep 16, 2023 @ 10:12pm 
PSA: I'll be updating this to use CustomData for settings and also changing the way seat ownership is checked (checks if PB/timer's owner can access the block instead of requiring pilot to be friendly with PB/timer).

The changes are in a separate mod for now, try it in your builds and let me know if there's issues or if it all works for you :}

https://steamcommunity.com/sharedfiles/filedetails/?id=3036873243
Digi  [author] Sep 11, 2023 @ 5:56pm 
The mod alone doesn't seem cause it: https://i.imgur.com/6jSBBH9.png

Can you try only this mod in a new empty world and see if it still does or not, if it doesn't then it sounds like it's one of the other mods and would be nice if you can narrow it down, like clone the world, remove half of the mods, see if it's still broken then remove half more and etc.
TheColossis Sep 8, 2023 @ 2:46pm 
Apologies. When I say control block, I mean a programmable block
TheColossis Sep 8, 2023 @ 2:45pm 
Yep. removing the mod immediately fixes the issue. Maybe a problem with the latest update?
TheColossis Sep 8, 2023 @ 2:39pm 
Possible issue. This mod seems to completely override a control block. As in, theres no edit button in order to load any script. Going to test by removing and I'll report back
Digi  [author] Jul 29, 2023 @ 11:01am 
You can give the blocks a unique tag in their name and use that tag as the partial name filter.
Like [Gunner] or something.
Nixeen Jul 29, 2023 @ 9:14am 
For the "Partial Seat Name Filter", how do I separate between 2 words? I want to allow Cockpit and Remote, but not Seat or Bench
Dleet3D Jul 4, 2022 @ 10:25am 
You updated it just now?
So how should I achieve this?
On the Timer Block do I set the cockpit name I'm sitting while controlling the CTC?
It would be better to set the name of the CTC (I want this Scroll Up/Down to trigger only when controlling this particular CTC).
Thanks!
Digi  [author] Jul 4, 2022 @ 9:08am 
I've updated it to consider the cockpit you're in while controlling CTC aswell (similar to what it supported with turrets).
Dleet3D Jul 3, 2022 @ 11:05am 
Is it possible to trigger Scroll Up/Down when controlling a Custom Turret Controller?
I wanted to use the custom turret controller to control left/right, up/down and then still be able to use the scroll wheel to control a piston.
Thanks
Digi  [author] Feb 6, 2022 @ 11:29pm 
Well you can do that with RotateIndicator from IMyShipController too, especially now in SEv200 that they fixed it not working for stations and other cases.
M.A.G.Gen. Feb 6, 2022 @ 6:34am 
FINALY! THAT IS WHAT AM I SEARCHING FOR!!! Now I can create a normal gui for my control station terminal! From now we finaly can make a GAME in another GAME! Or well... Windows-like operating system for controlling the entire ship from one terminal...
K9L9P9 Nov 11, 2021 @ 6:33am 
moc hezký Script... možnosti male i velké sítě ve hře pro mnoho bloků +1 (sít script) ale příkladu je víc. mod - live kamera - anténa ukradení signálu - krádež komunikace a možnosti ovládaní. Bezpečí přímo ve Hře,další stupnice možností ojedinělosti a funkčnosti. možná v budoucím čase i hratelnou formou zábavy. :-) už to přeci fungovalo!
Digi  [author] Aug 2, 2021 @ 12:09pm 
Triggering on release ofc doesn't have the key in the dictionary because it was released, the trigger stuff is primarily for speed and timer blocks.

If you program the entire behavior might as well just leave the PB running all the time, reading inputs and storing its pressed state so you ignore subsequent detections, then reset that state once the input is gone from the dictionary.

And you can optimize later by making PB turn off self-update if cockpit is no longer controlled, re-enable self-updates when PB is ran by mod.

If you need help programming it, #programmable-block in keen's discord can help :} Do mention that you're interfacing with a mod, but the mod part is not that complex if you just look at the inputs dictionary as "currently pressed inputs".

Alternatively, you could also try mechanical keybinds mod, I've never used it so I dunno if it can do what you want better, but try it: https://steamcommunity.com/sharedfiles/filedetails/?id=2267007067
Terence Hill Aug 2, 2021 @ 11:14am 
tinkering around with your script and I like the possibilites it can give, but I have a few issues:

I want to controll 2 rotors with WASD, but not holding the keys, but instead if I press "W" once it should increase velocity and if I press it again, it should reset it to 0.

I can't make it work, because I don't understand how to setup the triggering behavior.
If i set it to

Me.SetValue<int>("ControlModule.InputState", 2) //release

It seems to not find the pressed input in the inputs dictionary, when triggered on release.

inputs = Me.GetProperty("ControlModule.Inputs")?.As<Dictionary<string, object>>()?.GetValue(Me);


Also I would like to control 2 hinges and 1 rotor with mouse (with "leftshift" pressed as requirement), but that seems to need a different triggering behavior.

Can I use two Programmable Blocks with two different scripts (keyboard controls, like desribed at top; and mouse controls) ?
Digi  [author] Jun 7, 2021 @ 6:11am 
Put what in tho? What I said in the description is still accurate and no new inputs got added since the first stuff in SE v187.
I did add a link to another mod that makes PB's inputs reliable for MP clients tho :}
ElNico56 Jun 7, 2021 @ 3:55am 
On the page of MarmOS they say that PBs can read other inputs now tho, this is still useful for timer inputs and stuff but just as you wrote that this isn't entirely necessary for readin movement input, you should put that too i think
Digi  [author] Jun 6, 2021 @ 7:07pm 
Not quite, read the description :P
ElNico56 Jun 6, 2021 @ 5:32am 
isn't pb key reading a thing now?
Avarice Apr 13, 2021 @ 5:15am 
Alright, I think that would answer as a 'Yes, quite possibly.'

If I have any issues working this mod I'll check out the guide and hopefully get these legs moving first.

Thanks mate.
Digi  [author] Apr 13, 2021 @ 4:04am 
Well this does allow you to read any key/axis possible so yes, if you make the mech logic/code this can allow you to walk it with keys instead of toolbar.
Vanilla programmable block can also get movement and rotation inputs but they only work if you're in a cockpit that would be able to fly the ship (I also have a mod to fix that for MP).