Space Engineers

Space Engineers

26 ratings
Khodoque's RestWake Script
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
9.058 KB
28 May, 2019 @ 3:51pm
1 Change Note ( view )

Subscribe to download
Khodoque's RestWake Script

Description
Are you tired of pressing five buttons every time you dock your ship? Did your ship fell off the docking spire again because you forgot to set batteries to Auto? Do you hate doing complex setup for a script? Do you love doing complex setup for a script? Then this script is for you!

How does it works?
  1. Slap a programmable block on your ship
  2. Load this script
  3. Put your ship's connector right next to your target's connector
  4. Run this script with "rest" argument
Voila! Your ship is docked, all of its thrusters and reactors are toggled off, batteries set to Recharge and tanks set to Stockpile! Now if you want to disconnect your ship, simply run the script with "wake" argument, and it is ready to fly again! Now add both arguments to the toolbar.
But wait! You don't want to spare two slots on your toolbar for this script? Then simply run it with "toggle" argument, and you save another slot.

But what if I want more control over it?
Worry not, because it comes equipped with lots of options for you to play with!
First of all, the list of all commands (no hyphens):
"rest" - the rest routine, connects the ship and shuts down its systems "wake" - wake routine, enables all the systems and disconnects the ship "toggle" - "rests" the ship if it's "awake", "wakes" the ship if it is "resting"] "status" - current status of the ship "update" - very important command. If you changed something on your ship, run it to update the component lists. IMPORTANT: If your ship uses merge blocks to connect, you need to disconnect your ship manually and run the script with "update" argument before you use any other commands. "die" - shuts down the ship, disregarding the safety options (more on that later). "connect"/"disconnect" - just connects or disconnects the ship without changing any systems
You can change some variables in the code itself.
string RestWakeConnectGroup = "[RWC]"; string RestWakeToggleGroup = "[RWT]"; string AuxThrustGroup = "[RW_Aux]";
  • RestWakeConnectGroup - if you want to connect your ship not just with connectors, but also with landing gears and merge blocks, add them in this group. If you have set use_any_connectors to "false", also add connectors that you want to use to this group.
  • RestWakeToggleGroup - all blocks in this group will be toggled off during "rest" and toggled on during "wake" routine
  • AuxThrustGroup - any thrusters that you don't need during normal use. They will be disabled during "wake" routine. Chances are, if you have such thrusters, they are already in the group, so change the variable instead of making a new group for them.
string IgnoreTag = "[RWIgnore]"; string RestoredName = null;
  • IgnoreTag - all blocks from any group with this tag in the name will be ignored by this script.
  • RestoredName - if it's not null, the grid will be renamed to this during "wake" routine. Useful to restore the ship name if you connect it with merge blocks.
bool thrusters = true; bool batteries = true; bool reactors = true; bool tanks = true;
Set any of this to "false" if you don't want this script to affect any of these components.
bool safety = true;
If Safety is enabled, script will make sure that ship is able to connect to something before running the "rest" routine.
bool use_any_connectors = true;
If true, the ship will be able to use any of its connectors to connect. Otherwise, it will only use connectors from RestWakeConnectGroup.
Merge Blocks
Unfortunately, so far the script is unable to automatically connect with merge blocks. You need to manually merge with the target before running the "rest" routine. Disconnect works fine. Make sure that you used "update" argument while your ship was not merged, otherwise the script will affect the entire grid that it merged with. If your ship is not connected with merge blocks, it is safe to use "update" argument anytime.
Recommended mods
https://steamproxy.net/sharedfiles/filedetails/?id=1330904900

This one combines greatly with my script, but so far you need a timer block to run my script from Spug's script. Use a "die" argument in the timer block instead of "rest", since the Spug's script will ensure that the ship is docked safely.

Subscribe, rate, and link to this script if you use it in your workshop creation (or at least post the link to your blueprint in comments).
1 Comments
DogWater-Gaming69 31 May, 2019 @ 12:58am 
simple but useful script!!! thanks !