Space Engineers

Space Engineers

Change Light Color
67 Comments
Belfontan 5 Jan, 2021 @ 5:22pm 
@Netherspark
You can trigger more groups at once with a timer block.
Otherwise: No

@mipam
I don't think so
mipam 3 Oct, 2019 @ 12:13am 
Greate script. Is it possible to change lcd background light as well?
Netherspark 7 Sep, 2019 @ 12:29pm 
Is it possible to have it toggle two light colours with a single trigger?
Belfontan 18 Apr, 2019 @ 11:33am 
@Zues
Yes you can do that, but you will have to adjust the blinking offset by yourself.
After that you can switch between running and static light with f.e. a sensor or a Timer.

Aktiv:
MyRunningLightsGroupForPad3A,YELLOW,3

Inaktiv
MyRunningLightsGroupForPad3A,WHITE,0
Belfontan 18 Apr, 2019 @ 11:28am 
@Freedom isnt free (Swazzo)
How they are called is on you.
You will have to send the PB commands like:

ThisIsMyAwesomeLandingPadBlinkyFlashLightsHell,Green,3

This will make your Group of lights (or single light) named "ThisIsMyAwesomeLandingPadBlinkyFlashLightsHell" to blink in green every 3 seconds.

@Sythius
Very nice script! Works very well.
Thank you so much.
SwazzozzawS 3 Sep, 2018 @ 6:01am 
How do you use it do I group the blocks together what do they have to be called
Zues 3 Apr, 2018 @ 8:05pm 
just saw this scrtipt and its is amazing I have been needing this for a long time, for my airlocks so people would know if there was air in an airlock or not.

Now for the very importent question can this be set up to do running lights? 2 rows of lights lets say 10 lights long. so you could have them running outward for exiting ships and press a button and have them running inward for incoming ships?
SuperKooks 28 May, 2017 @ 2:23pm 
Ok, thx
Sythius  [author] 24 May, 2017 @ 12:25pm 
I will have a look at the script and make sure everything is running fine. I have not used it in a while, I will see if there is any upgrades I can do.
SuperKooks 17 May, 2017 @ 3:00am 
This isn't working for me. I am using 01.180.4 minor. I am using the arguments All_Lights, Red
All_Lights is the name of my group im trying to change the color of. If anyone could help me, it would be appreciated.

UPDATE:
When I use the group name "Lights_Group_01" it works fine.
CadyJay 7 Apr, 2017 @ 12:08pm 
yes but the lights are off and i have to turn the blink on and off again from the control panel
Sythius  [author] 7 Apr, 2017 @ 11:44am 
Yeah you can set it back by just passing white to the trigger. e.g. Lights_Group_01, White
CadyJay 7 Apr, 2017 @ 10:40am 
can u set the lights back using this if u can how?
Indrasil 20 Mar, 2017 @ 9:14am 
How can I reprogram the script so that I can set Blink Length as an argument?

Also more importantly, I'd like to set different Blink Intervals for Enable and Disable states.

It would be very handy if I could set different Light Intensity and Falloff as arguments as well.

I'll mess somewhat with a script myself but I'm not an experienced programmer so I don't expect it to be easy.
carn1vore 1 Mar, 2017 @ 8:23pm 
Very nice script! How can I make this work for lights on connected grids? i.e. using a small block PB to change lights on a connected large grid.
EnjoyCoke 19 Dec, 2016 @ 4:09pm 
This was exactly what I was looking for!
Now, any pilot docking his ship can simply have a little docking light set anywhere in view - even inside his CIC of the massive Orpington05, and not have to rely on external cameras to dock with. Just slide forward ever so slowly until the light changes - then connect and you're docked :D
This is AWESOME!
EnjoyCoke 19 Dec, 2016 @ 3:54pm 
YES!
THIS IS PERFECT!!!!!!!!!!
Sythius  [author] 19 Dec, 2016 @ 9:18am 
I have played around with the Connector and found the 'OtherConnector' variable, used with the 'IsConnected' variable you can detect if someone is connecting to the Connector before they have Locked the Connector. When a player is in range of the connector and being pulled in the Lights should change. Not too sure if that's what you wanted but here is the script for it. It also includes Groups for multiple Lights and different Connectors.

http://pastebin.com/vjb8By42
EnjoyCoke 17 Dec, 2016 @ 12:44pm 
I've fooled about a little and this is what I ended up with:
http://pastebin.com/sTuLSJnP

it now makes stuff red if the connector is not turned on.
Yellow/orange if turned on, but not connected
Green if connected.

However, I can see on the API page that there's nothing called "in range" - yet the game clearly responds to another (friendly) connector coming within range.

Anywho - it would appear this is the best I can get for the time being. Would there be any chance for you to help me with setting up the script so it works for groups of blocks and not just the first block in the list responding to the unique ID?

Thanks a lot for your help, as always :D
EnjoyCoke 17 Dec, 2016 @ 12:09pm 
But the problem with the sensor is that it would detect a potential docking too early - since its minimum range would be 1 meter - meaning it'd stick out of the centre of a block (even if placed underneath the connector.
But thanks a lot for taking the time to look into this, regardless :D
Sythius  [author] 17 Dec, 2016 @ 9:17am 
Not looked too much into the connectors, the programmable block is a bit limited at the moment, but I think it can be done. I will write a script that detects the connectors On/Off state and changes the Lights, not too sure if the connector has a ready or range that are available to us. I can find out using the SDK, if not I think you can use a sensor to check if they are in range and change the lights. I will see what I can do.
EnjoyCoke 11 Dec, 2016 @ 4:18pm 
Basically, when a connector comes in range of another connecor, the little rim around it and the crosses on the side go from white to yellow - and when parked/ connected green. Is this not something that the programable block can detect?
EnjoyCoke 11 Dec, 2016 @ 4:13pm 
Doesn't Connector and landging gear have a "isready" boolean? That was what I was hoping - as that would allow me to have two lights (or more, but let's just go with two for now) that are off/black (0, 0, 0,) when turned off (connector onoff_off obviously), then goes another colour (something-something) when turned on (the onoff_on) and then when in RANGE/ ready, it goes another?
It should be possible, since the right side of the screen shows "Landing gears in range", meaning that the game can detect when a landing gear is in range - I was thinking that could be possible for connectors too?
Not sure if I make any sense here.
Sythius  [author] 11 Dec, 2016 @ 6:06am 
When do you want the Lights to change? If you need the Lights to change when a ship is in range of a connector or Landing gears then you can use a Sensor to run the Programmable Block on enter and exit of sensor. If you need it to change the Lights when the connector is Locked/Unlocked then i can edit the script to do that.

You will need to cast it to the 'IMyShipConnector' interface, it contains a 'IsLocked' boolean you can use. You can find a bit more info about the blocks at: https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=360966557
EnjoyCoke 9 Dec, 2016 @ 3:07pm 
I'm looking for a script that constantly 'scans' and upon finding a connector/landing gear in range of connection it changes the colour of a set group.

I've been using the custom made you gave me for "gatlin guns" - turning red and blinking if gatling guns were shooting, going orange if idle, and turning blue/green if disabled/offline.

But I can't simply translate the gatlingguns string into "connector", as I don't know what to do. Will you help me out again? I used the one you gave mere: http://pastebin.com/7dy1VwhJ
And tried to change the IMyGatlinggun to "IMyConnector" but that wasn't enough - obviously something else needs changed. Will you help me, mate?
EnjoyCoke 29 Oct, 2016 @ 12:56pm 
ABSOLUTELY AMAZING!
Sythius  [author] 16 Sep, 2016 @ 4:02pm 
No problem. I will get updating it now, should be updated soon.
Twelve Cats 15 Sep, 2016 @ 10:26am 
Yeah, due to an update, 'IMyBlockGroup' I think is removed or something? Happened to some other scripts I was using, and so this no longer works. Pretty cool idea though
AusLity 12 Sep, 2016 @ 10:40am 
Will you be updating this anytime soon im getting compile issues :)
Sythius  [author] 2 Jul, 2016 @ 9:32am 
I have updated the Script to allow a basic and advanced usage. You can pass over the group name, Colour name and Blink Interval as arguments or you can edit part of the script to allow multiple Groups of Lights with different Colour's to be activated at once.

Can only access Lights that are connected to the same Grid System.
User Not Applicable 14 Jun, 2016 @ 10:45pm 
I was wondering if editing this would make it able to correspond to a 'lights' group i have set inside my station? So that way i can controll all my lights' colors (mods or not) with that group i made?
Mr B. 28 Mar, 2016 @ 9:34am 
I've got a suggestion:

Have the ability to add colours to arguments. This means that you could add the PB to the menu bar at cockpit/control chair and simply activate a preset colour to a set of lights.

So 1st option would be set a group of lights to blue, 2nd would be orange, etc etc.

In short, it would be a way of changing light colours simply by using the menu bar in a cockpit.
Sythius  [author] 9 Dec, 2015 @ 5:11am 
I am going to have a tinker with the script, add an optional sound block and see what else i can upgrade.
[VVAR] Razzun 4 Dec, 2015 @ 12:55pm 
I need to double check, but I believe so. I have a workaroud installed with a timer block delayed by 2 seconds to turn the lights back on.
Sythius  [author] 4 Dec, 2015 @ 3:53am 
Sorry for the late reply. Are you still having issues with the lights being disabled?
[VVAR] Razzun 26 Nov, 2015 @ 2:25pm 
Having issues with the lights not staying on when you move to "disable" from enable with blinking. Any help would be great.
VORG 28 Jul, 2015 @ 4:01am 
Thanks for updating the script for scrub programmers like myself haha.
Sythius  [author] 27 Jul, 2015 @ 12:46pm 
Updated and working again now.

The function 'GridTerminalSystem.BlockGroups' has been changed too 'GridTerminalSystem.GetBlockGroups(groups)'
Sythius  [author] 27 Jul, 2015 @ 12:19pm 
Thanks for pointing that out, i will get on a fix right away.
VORG 18 Jul, 2015 @ 7:47pm 
This worked in patch 1.090, but as of 1.091 I am getting an "Assembly Not Found. Please recompile script" error. Any ideas on how to fix this?
Sythius  [author] 4 Jul, 2015 @ 1:53pm 
Sorry for the late reply, thanks pinna55 for replying. There is a couple ways that could help, you can set up 2 timer blocks, one runs the script and then starts the second timer block and the second timer block can run the script then start the first timer block. If you still need i can add this feature to the script so you can have it with just a programmable block.
doofy 4 Jul, 2015 @ 9:55am 
I bet you could link a bunch of programmable blocks with the same script, but different colors for the same light. They can run in sequence.
🍁BuzzedBear🍁 14 Jun, 2015 @ 11:02am 
Is there a way to have the lights flash alternating colors? IE: 1 red blink then 1 green and back again?
[VVAR] Razzun 22 May, 2015 @ 8:06pm 
A lot nicer now. *Thumbs Up*
Sythius  [author] 22 May, 2015 @ 4:46pm 
I have added the blink feature but needed to use a Timer Block to sort out the Blink issue as you can't turn it off and on so fast, i'll see if i can find a way without using the timer block. Hope it helps.
Sythius  [author] 20 May, 2015 @ 1:14pm 
The Programmable Block has changed slightly since i last used it, now you can add a parameter and you can put the same Programmable Block on the same Sensor trigger for On Enter and On Leave. This has made it very easy to do things on the same Programmable Block so i am going to be changing the code for all my in-game scripts.

I will add a blinking feature too, thanks for the info.
[VVAR] Razzun 20 May, 2015 @ 8:21am 
No problem. And thanks for the mod. A lot easier to use someone else's work than have to create something yourself, especially when your personal coding skills are rusty at best! The only issue I haven't fixed (with my modified code) is if the lights are going from blinking to always on, if you don't hit it when the lights are actually on, the lights turn off. So you have to switch back and forth a couple of times to get the lights to come on. I think an easy fix would be in the script to add a "turn lights off" command before any changes, then "turn light on" after the changes. I just didn't get a chance to research it yesterday.
Sythius  [author] 20 May, 2015 @ 7:53am 
Thanks for the code, I will update the script and add the feature in, i will add it for groups so you can have several colours on several lights, for anyone who wants that. I will have an update out later today, although the update video might not be out till later tonight.
[VVAR] Razzun 19 May, 2015 @ 6:00pm 
And above my below comment, new variables:
Color ColorOne = new Color(255, 255, 255); // <--------- Color One (set to white right now)
Color ColorTwo = new Color(255, 0, 0); // <--------- Color Two (set to red right now)
float BlinkInt1 = 0.0f; // <---------- Blink Interval for Color Group One (in seconds)
float BlinkL1 = 0f; // <--------- Blink Length for Color Group One (in percent)
float BlinkInt2 = 1.0f; // <---------- Blink Interval for Color Group Two (in seconds)
float BlinkL2 = 50f; // <---------- Blink Length for Color Group Two (in percent)
[VVAR] Razzun 19 May, 2015 @ 5:59pm 
Well, I can't send you a PM, so hopefully this works:
Main section I changed:
if(Light != null) {
var currentColor = Light.GetValue<Color>("Color");
if(currentColor == ColorOne) { // Check to see if color one is set, if so, change it.
Light.SetValue("Color", ColorTwo);
Light.SetValue("Blink Lenght", BlinkL2); // Yes, Length is spelled wrong. That is the way it is.
Light.SetValue("Blink Interval", BlinkInt2);
}
if(currentColor == ColorTwo) { // Check to see if color two is set, if so, change it.
Light.SetValue("Color", ColorOne);
Light.SetValue("Blink Lenght", BlinkL1);
Light.SetValue("Blink Interval", BlinkInt1);
}