Space Engineers

Space Engineers

78 ratings
Alarm - Battle Ready with one click (UPDATED 2015-07-17)
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
3.597 KB
22 Mar, 2015 @ 3:22am
17 Jul, 2015 @ 12:42pm
4 Change Notes ( view )

Subscribe to download
Alarm - Battle Ready with one click (UPDATED 2015-07-17)

Description
UPDATE 2015-07-17: had to update this script because Keen decided to change something in the API.
@Everyone: edit your programmable block and insert the Script from Workshop again to make it work again.

(Warning: If you have customized the upper part of the script with your own texts etc. make sure to back that part up before you reinsert my script (using CTRL+C and CTRL+V and such). Unless you enyoy typing in all your customs text again, that is)



Aside from the obvious effect of playing sound blocks and turning normal lights into red, blinking lights this script can also turn on turrets, turn off refinerys and assemblers and stop recharging batteries to save energy, lock doors, and append a alert text to your beacons and antennas.
Starting the alarm can make your ship or station battle ready with just one click, or even automatically in some cases.

After ending the alarm, all lights and other settings will be returned to the original settings.


The alarm can be triggered in the following ways:

1) manually. Turn on a interior light named "AlarmOn" and the alarm will start after about 1 second. Shutting this light off is also the only way to end the alarm.
I recommend to make a button panel and/or cockpit key to toggle the "AlarmOn" interior light on and off.

2) damage. Doing damage to a block on the same grid (ship or station) will automatically start the alarm. Damage to blocks without consoles (armor blocks mostly) can't be
detected unfortunatly, this is a limitation of the current In-Game Programming.

3) hacking. Using the grinder on a ships block is not counted as damage, instead it is counted as hacking attempt. Grinding your own blocks doesn't count as hacking.

4) sensors. If you place any sensors in the "AlarmBlocks" group, anything triggering one of the sensor will call the alarm. Note that the script can't determine if the sensor
was triggered by an enemy, friend or something else. Just modify the sensor settings accordingly.

5) text panels. If you add a text panel to the alarm blocks group and end its name with IN, for example "My text Panel IN", the script will scan the text for certain keywords and call the alarm when any is found. The standard keywords are "Enemy", "Hostile" and "Winter is coming". You can change them in the configuration section of the script (upper part).

Following blocks can be modified by the script, if added to a group named "AlarmBlocks":

- Interior lights and spotlights. They will turn red and start to blink. Original light settings are restored after ending the alarm.
- Soundblocks. They Will be played only once, so make sure you set the loop timer.
- Antennas / beacons. A warning with the alarm reason will be added to the beacons / antennas name. Original name is restored after ending the alarm.
- Text Panels. A short message of the alert reason will be added to the text. The text is NOT reset after ending the alarm.
If the name of your text panel ends with "in", the script will instead search for the occurence of keywords like "enemy" and "hostile" in the public text, and start the alarm if found.
- Turrets will get turned on during alarm, and turned off after alarm if they were off before.
- Doors (including airtight hangar doors). Door will close during alarm, and reopen again after alarm - if it was open before. If the name of the door ends with "OPEN", the behaviour is reversed - that is, it will open during alarm.
- Batteries. Recharging the batteries is turned off during alarm.
- Refineries and assemblers are turned off during the alarm, to save energy. Turned on again after alarm, if they were on before the alarm.
- Sensors. Any sensor placed in the "AlarmBlocks" will automatically turn on the alarm if it detects anything.
- Timer Blocks. Timer Block will be triggered once when the alarm is started. If the timer blocks name ends with "END", it will instead be triggered at the end of the alarm.
This allows you to start your own, custom actions on alarm and also to undo them once the alarm is over.

Installation:

1. insert the code into a programmable block
2. add a timer block that calls itself and runs the programmable block, every second
3. Add a interior light named "AlarmOn" somewhere on your ship / station
4. Add a group named "AlarmBlocks". Add as many lights, turrets, sound blocks, doors, refinerys and text panels as you like. Only this blocks will be modified by the alarm, all others will be left alone.

5. Done. The alarm will now get started when you manually turn on the "AlarmOn" light or if a block with a console on it gets damaged (damage to armor blocks can't be queried

with ingame programming,unfortunatly.) Turn off the alarm by turning off the "AlarmOn" light.

Configuration:

The first few lines of the script (not counting the comments, marked by // ) are dedicated to configuration variables.
You can modify the text written to text panels, change the color of the alarm lights or the keywords that are searched in the "IN" Textpanels

Update 2015-03-29:

- can now trigger timer blocks on start or end of alarm. Just add them to "AlarmBlocks" group. Normally, timer blocks are called on start of the alarm. End their name with "END" and they will instead be called at the end of the alarm.
- doors can be opened instead of closed during alarm, just add "OPEN" to the end of the name.
- script can search for certain keywords in text panels and sound the alarm if found. Only works for text panels in "AlarmBlocks" group that else have a name ending with "IN". Useful in combination with other scripts that communicate via text panel too. The keywords are configurable

Disclaimer:

Be warned if you add many, complex lighting settings to the "AlarmBlock" group. The script is designed to reset all light settings back to their original settings when you end

the alarm, HOWEVER I can't guarantee that this will ALWAYS work.
52 Comments
Zer0Gamler 4 Sep, 2021 @ 12:25am 
I did make an update my self with no timer support and added the rotary light from the deco DLC #2:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=2592996560
I will remove my script if the author updates his script.
ThatGuyConnor 23 Aug, 2019 @ 12:49pm 
its just says no assembly found please compile script what am i doing wrong i would like some help with this. :cozyspaceengineersc:
Fish 22 Feb, 2019 @ 3:24pm 
Anyone have a collection of all the scripts made by this guy?
usswat64 1 Jan, 2019 @ 3:26pm 
How do yo stop the Blinking lights and return them to normal?
izzzy80 26 Jun, 2017 @ 3:19pm 
Working Version can be seen here.. untill original author can fix.
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=951016901
izzzy80 19 Jun, 2017 @ 8:16pm 
I have a working version on my game.
BevansDesign 26 May, 2017 @ 1:07pm 
Sadly, doesn't work anymore.
LowTechRider 14 May, 2017 @ 3:59am 
Can someone update this script, it's pretty badass but it got two errors
MJ Koss 21 Jan, 2017 @ 6:01pm 
Scrip has errors, will there be an update in near future?
ANTi Yippee ツ 19 Sep, 2016 @ 3:47pm 
PLS UPDATE THE SCRIPT