Space Engineers

Space Engineers

Not enough ratings
SAMv2 vMod Differences and Additions
By SCBionicle
This is a walkthrough of differences and configuration of SAMv2 vMod as compared to the original SAMv2.

The workshop link for the script: https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=1941423134
   
Award
Favorite
Favorited
Unfavorite
Before Reading
This script is an improved version of the auto pilot script made by Sam linked here: https://gtm.steamproxy.vip/workshop/filedetails/?id=1653875433

Credit should go to the original author of the script in the link posted above. Also, all images and videos are from the original script's workshop page. I will also be aiming to keep this to be backwards compatible with the original SAMv2 script.

Also, please be aware that modded connectors confuses scripts. If you're using one here, the ship might not dock correctly. Also, if you're using the VCZ Airtight Connectors, please refer to the connector tags below.

Please follow Sam's guide on how to set up your ship from the link above. However, for any additions or modifications to this script, please refer to below.
Commands (Arguments in Programmable Block)
  • Next = next item in list
  • Prev = prev item in list
  • Clearstorage = reset all save data in this program (recompile needed after this)
  • Clearlog = clear the log
  • Start = start auto pilot to selected destination in nav screen
  • Start [GPS] = start auto pilot setting a course to pasted GPS coordinate
  • Start next = start auto pilot going to the next destination on the navigation screen
  • Start prev = start auto pilot going to the previous destination on the navigation screen
  • Stop = stop autopilot
  • Screen = switch between conf screen and nav screen
  • Select = add or remove waypoint/dock from nav screen (only works in conf screen)
  • Add = add current position in conf screen
  • Add stance = add current position and direction to conf screen
  • Add dock <optional: station name> = save currently connected dock to list of docks you can navigate to (can actually dock to the target as long as it doesn't move)
    (IMPORTANT: Make sure you're docked with only one SAM assigned connector)
    (IMPORTANT: Does not work when target dock uses reverse connector)
  • Add [GPS] = add pasted GPS coordinate to conf screen for later navigation (name of coordinate will be saved)
  • Go [dock name] = Go to specified dock name (must be broadcasted by SAM at destination and must be known by ship first)
  • Remove = Delete selected old dock/waypoint/GPS coordinate from nav/conf screen
  • Undock = initiate undock sequence
  • Save = save all data to storage (saving data is done automatically when game autosaves or if the script is recompiled)
  • Load = load all data from storage
  • Toggle = start/stop autopilot
  • Scan = scan the grid for changes
Autopilot Options (Put In Programmable Block's Custom Data)
  • SAM.Speed=(integer) - The speed in m/s which the ship should go when navigating around obstacles (have this slower than converging speed so that the ship has a better chance of collision avoidance)
  • SAM.Taxi_speed=(integer) - the speed in m/s in which the ship moves when following the runway
  • SAM.Approach_distance=(integer) - the distance in meters of which the ship initially approaches the runway or target connector
  • SAM.Dock_distance=(integer) - the distance in meters above the connector which the ship approaches before initiating the docking sequence
  • SAM.Dock_speed=(integer) - the speed in m/s in which the ship docks to the connector
  • SAM.Approach_speed=(integer) - the speed in m/s in which the ship approaches the connector
  • SAM.Taxi_distance=(integer) - the distance in meters above the runway the ship will follow
  • SAM.Converging_speed=(integer) - the maximum desired speed in m/s when the ship is navigating to its destination when it has a clear path
  • SAM.Arrival_distance=(integer) - the distance in meters in which the ship slows down when approaching its destination (adjust this to help avoid overshooting)
  • SAM.Arrival_speed=(integer) - the speed in m/s in which the ship moves when approaching its destination (have this speed slower than the converging and navigating speeds to avoid overshooting especially when having weak thrusters)
  • SAM.ESCAPENOSEUP - add this to allow the ship to point the nose of the ship up or down when entering or exiting a planets gravitational field (the flip upside-down glitch was fixed, poor documentation of the ModAPI contributed to this)
  • SAM.Nose_up_elevation=(integer) - the altitude above the surface in which the ship points its nose up and down while in a gravity field (requires SAM.ESCAPENOSEUP to enable)
  • SAM.Nose_down_elevation=(integer) - (available vMod 10.1.0+) the height above ground at which the nose is pointed down. (whether the ship levels off or not is based on vertical speed and not direction) (requires SAM.ESCAPENOSEUP to enable)
    • NOTICE: if this value is not set, it will match the Nose_up_elevation setting
  • SAM.SLOWONAPPROACH - enables the ship to slow down to taxi speed when getting nearest to the destination of which collision avoidance turns off
  • SAM.ALLOWDIRECTALIGNMENT - in space, this enables the ship to align directly at the destination rather approximately before taking off
  • SAM.Auto_cruise=(float) - add this to both enable and set an auto cruise sea level altitude. Remove this attribute or set to NaN to disable. (This value can be updated live during flight) (NOTE: Using this could prevent SAM from crashing directly into the ground after takeoff when the destination is on the other side of the planet)
Connector Tags (Put in name or custom data)
Custom Data
Block Name ("..." indicates other optional tags)
Description
SAM.REVERSE
[SAM ... REVERSE ...]
Some modded connectors are placed backwards to work for some reason. It confuses this script. If the connector goes on backwards, add this tag to the connector to work around that. Use the BuildInfo mod to make sure that this is the case.

Timer Tags (Put in name or custom data)
Custom Data
Block Name ("..." indicates other optional tags)
Description
SAM.DOCKED
[SAM ... DOCKED ...]
This timer starts after successfully docking
SAM.NAVIGATED
[SAM ... NAVIGATED ...]
This timer starts after successfully reaching its destination
SAM.STARTED
[SAM ... STARTED ...]
This timer starts after starting navigation
SAM.UNDOCKED
[SAM ... UNDOCKED ...]
This timer immediately fires when navigation starts and the ship undocks
SAM.APPROACHING
[SAM ... APPROACHING ...]
This timer starts when the ship begins its docking sequence.
Cockpits/Control Seats (LCD Display) (Put in block name or Custom data)
Custom Data
Block Name ("..." indicates other optional tags)
Description
SAM.Slot=(integer)
[SAM ... Slot=(integer) ...]
0-indexed slot to have the script show the nav/conf screen in on a control seat or cockpit that has LCD surfaces. (First slot would be 0 and the last would be the total amount of slots-1) (Important: there's no space between Slot= and the integer)
Capabilities
What This Version Can Do Over the Original:
  • More control over how fast your ship goes depending on what it's doing (is it docking, avoiding collisions, heading straight to the destination, etc? You control how fast it goes on each thing.)
  • This does not exceed the speed limit by more than a few m/s. (Disclaimer: if the speed limit is decreased, the ship will need time to slow down)
  • Mechanisms to help avoid overshooting and overspeeding as configured by the user.
  • Does not shoot straight up and slowly sink back down when undocking (on planets).
  • More reliably get from point A to point B than the original script (this is not fool proof though)
  • Reach an assigned cruising altitude to more quickly get from point A to B rather than crawling across the terrain or crashing (this must be enabled though)
  • LCD displays on cockpits (this was half-implemented in the original version and currently does not work until the bug is fixed, but it works in vMod)
What This Version Cannot Do Over the Original (which I plan to add in in the future when the original author updates his code on Github)
  • Remotely control the ship through another SAM programmable block
  • Wait for batteries to charge, unloading and loading cargo before undocking automatically
Bugs?
Also, when reporting bugs, please post them here so I can better organize what's wrong. https://github.com/sugardose/SpaceEngineers/issues

You're still free to post them here, but it'll be harder for me to collaborate with you about what's wrong.