Space Engineers

Space Engineers

479 ratings
[PAM] Path Auto Miner | Guide
By Keks
This guide describes how to use PAM.
Get the script here: https://steamcommunity.com/sharedfiles/filedetails/?id=1507646929
6
3
2
2
2
2
2
2
2
   
Award
Favorite
Favorited
Unfavorite
General
The development of PAM is stopped due to i stopped playing SE.

The script runs well with the latest SE version, if something doesn't work it could be due to mods.
Please understand that i'm not active here to answer your questions.
If any future SE update will break PAM i will do my best to fix that.

Big thanks for all your support, cheers!





This script was started as "mining only" script (thats why its called "Auto Miner")
But in the meantime i have added more and more functions, now it is a multifunctional script for different types of tasks.
Currently there are 4 different script modes:

Mining mode: fully automated mining
Grinding mode: fully automated grinding
Shuttle mode: fully automated transportation of items and players
Station mode: Stationary monitoring system for your ships


The script uses a specified path to fly between your docking station and the job position. (It does not use the buggy pathfinding function of the remote block)
It is designed for planets and space. It works with small and large ships.
The usage is pretty simple and with all script modes similar:

-Dock your ship to a connector
-Start recording the path
-Fly to the job area
-Stop recording
-Setup the job and start the process

That's all.

The script starts executing the configured job, and flies fully automated between the positions by using the path.

General features
- Automated traveling between base and job area along the path (must be recorded befor)
- Works in space, on planets, with small and large ships
- Useful monitoring settings
- Useful behavior settings
- LCD menu, controlled by 3 commands (UP, APPLY, DOWN)
- Many commands to control it from distance

Note:
- PAM can only connect to stationary connectors, moving connectors are not supported.
- You can convert a carrier/mothership into a station to make it compatible with PAM
- Path can be recorded: dock to job position or: job position to dock, it does not matter
Script mode overview
This script has 4 different modes for different tasks.
The activated mode is depending on your ship tools or name tags:

Mining mode: Ship has drills
Grinding mode: Ship has grinders
Shuttle mode: Ship has no drills and no grinders
Controller mode: PB has the nametag: [PAM-Controller]

The mode will be enabled with the first run of the PB automatically.
You can reset the mode by running the "RESET" command.
The shuttle mode can be enabled manually with any ship by running the "SHUTTLE" command.
Mining mode
Features
- Fully automated mining process
- Adjustable width, height and depth of the excavation
- visualisation with sensor range field

How to use:
Finish ship setup first

Enter mining mode:
- Load the script on a ship with drills and the mining mode will be enabled automatically
- if you want to reset the mode run the "RESET" command

Setup Path & Connector:
- Dock to a connector (Home connector)
- Start recording
- Fly to the job area
- Stop recording

Setup Job:
- Select "Setup mining job"
- Set the job size (width, height, depth)
- Start the job
- The ship starts mining now
- If the ship returns to base immediately check your energy/fuel behavior settings (it gives you an error message on the lcd screen)

Note:
- You can start mining without set a path, but when the ship is full, it stops
- Changing the size of a running job will made lost the progress, it starts from begin
- Sensor can only visualize sizes up to: Width/Height 100m, Depth 50m
Grinding mode

Features
- mostly the same as mining mode, but with grinders instead of drills

Note:
- a sensor is required and not optional (named with [PAM] - tag)
- convert the grid that you want to grind to a station, or fix it on another way
- some blocks cant be grinded very well like turrets, hangar doors and laser antennas. This is due to the collision box of this blocks. So your drone could be stuck there.
- grinding down large grids works much better than grinding down small grids

Shuttle mode
(This is still in development)

Features
- Traveling between two connectors
- Possibilities to automate shuttle tasks (automated freighters, taxis and more)
- Individual & adjustable undock conditions
- Trigger timers on docking events

How to use:
Finish ship setup first

Enter shuttle mode:
- Load the script on a ship without tools (drills, grinders) and the shuttle mode will be enabled automatically
- Or run the "SHUTTLE" commad to enter the mode manually
- if you want to reset the mode run the "RESET" command

Setup Path & Connectors:
- Dock to a connector (Home connector)
- Start recording
- Fly to the other connector & dock (Job connector)
- Stop recording

Setup Job:
- Select "Setup shuttle job"
- Beneath "Leave connector1" and "Leave connector2" you can change the undock conditions
- (Optional) Set timers for docking events on the 2nd page
- Start the job
- The ship flies to the nearest connector, job is active now

If the configurated undock condition is suffused for the respective connector then the ship will undock and fly to the other connector.

Note:
- The ship must have enough energy/fuel (depending on the behavior settings) otherwise it cant start undocking.
- If the shuttle job is running and the ship is waiting for a undock condition,
then you can run the "UNDOCK" command to skip the condition check.

Timer events
- Place some timer blocks on your ship
- Select the respective timer block for a certain event in the "Job setup" menu (2nd page)

Note:
- Timers are only triggered if the job is running. These are not triggered if you use "Fly to home/Job position"
Controller mode



The PAM-Controller is a system which you can place in your base or mothership. It gives you some special remote control functions about your PAM controlled ships.
It use the antenna broadcast to send and receive messages to and from your ships.

Features:
- See the state of your ships on one lcd
- Remote control the PAM-menu of your ships
- Dispalys the current inventory of your ships
- Send commands to all or a specified ship
- Setup LCD's with different content modes

Setup
Finish ship setup first

General: (Ship and station)
Antennas:
- Enable broadcasting
- Make sure the range is high enough

PAM version:
- Ship and controller needs the same PAM version
- If the version is different then it will not work

Station:
Programmable block:
- Add the tag: [PAM-Controller] to the name
- Load the PAM script or recompile it
- Setup the commands UP, APPLY, DOWN to a button panel, flightseat, etc.
- Check out the PB custom data if you want to change the broadcast channel

LCD:
- Add the tag: [PAM] to the name
- Define the display mode in the custom data (Run PB first)

LCD's of Seats and other Blocks]
- Add this Tag to the block with the LCD's: [PAM:<LCDIndex>]
- <LCDIndex> is the number of the LCD in the LCD Panel List of this block
- e.g: Cockpit [PAM:1]
Important:
- Currently you have to adjust the font size manually


Ship:
Programmable block:
- Open the custom data of the existing PAM - PB
- Set the "Ship_Name" e.g. "Miner 1"
- Set "Enable_Broadcast" to "true"

After a few seconds the ship should be displayed on the LCD of the controller.

Note:
- If a miner does nothing then the communication to the controller is reduced (longer refresh times)
Controller mode - How to...
How to remote control the miner's menu:
- move cursor on the main display to the first line of your miner (e.g.: Miner 1: Job done 10m)
- select miner with "apply" button
- press "down" button 3 times: 1=jumps to "Send cmd", 2=activates remote mode, 3=move the remote cursor
- press "up" button multiple times to exit the remote mode

How to setup multiple PAM-controllers with individual connected ships:
- you can setup individual communication channels when multiple controllers and ships are in the same antenna range
- just define a custom channel name to pair a specified controller with specified ships
- the "Broadcast_channel" variable can be found in the custom data of the PB (ship and controller)
- the channel name of ship and controller must be the same

E.g.
Controller A -> Channel name: #default
Controller B -> Channel name: #earthMiners
Controller C -> Channel name: #moonMiners

Miner A -> Channel name: #default
Miner B -> Channel name: #default
Miner C -> Channel name: #earthMiners

Controller A has 2 connected ships
Controller B has 1 connected ships
Controller C has 0 connected ships

( "#" befor a channel name is not required)

How to have multiple PAM-controllers on the same grid?
- Setup one PAM-controller as usual (PB + LCD + e.g. Button Panel)
- Place a 2nd PAM-controller on the grid (with [PAM-Controller] tag)
- Change this line in the script:
"const String pamTag = "[PAM]";" to "const String pamTag = "[PAM2]";"
- Add a 2nd LCD with the [PAM2] tag
- Place a 2nd Button Panel and setup the commands to the 2nd PB as usual
- Done
- Now you can use the "Broadcast_Channel" to assign ships to a certain controller
Ship setup

NOTE: This script is not tested with mods, you can try it but maybe it will not work.

General
- Required blocks: Remote control, Programmable block, Connector, Thruster, Gyroscopes, Drills(mining mode), grinders(grinding mode)
- Optional blocks: LCD, Sensor (required with grinding mode)
- Your docking station needs sorters with “Drain all” settings enabled, to drain or fill the ship

Remoteblock
- Must be aligned in flight direction
- The remotes down side must be facing in the same direction as your ships down side
- Add the [PAM] - tag when there are more then one available
- When it gets destroyed, the script stops every task. Take care about it.



LCD
- Add the [PAM] - tag
- You can have multiple LCDs

LCD's of cockpits and other blocks
- Add this Tag to the block with the LCD's: [PAM:<LCDIndex>]
- <LCDIndex> is the number of the LCD in the LCD Panel List of this block
- e.g: Cockpit [PAM:1]
Important:
- Currently you have to adjust the font size manually


Landing gears
- Add the [PAM] -tag depending on the wanted behavior:
- if no landing gear is tagged: PAM controls all landing gears of the ship
- if one or more landing gears are tagged: PAM controls only landing gears with the tag

Batteries
- Add the [PAM] -tag depending on the wanted behavior:
- if no battery is tagged: PAM controls all batteries of the ship
- if one or more batteries are tagged: PAM controls only batteries with the tag

Sorters
- Add the [PAM] -tag depending on the wanted behavior:
- if no Sorter is tagged: PAM controls all sorters of the ship
- if one or more sorters are tagged: PAM controls only sorters with the tag
- Note: You need to enable "Toggle sorters" in the behavor settings

Connectors
- Add the [PAM] -tag depending on the wanted behavior:
- if no connector is tagged: PAM controls all connectors of the ship
- if one or more connectors are tagged: PAM controls only connectors with the tag
(Connectors without the tag can't be used for docking then)

Hydrogen tanks
- Add the [PAM] -tag depending on the wanted behavior:
- if no hydrogen tank is tagged: PAM controls all hydrogen tanks of the ship
- if one or more hydrogen tanks are tagged: PAM controls only hydrogen tanks with the tag

Sensor
(Only Mining & Grinding mode)
- Must be aligned in mining direction (see the screenshot below, note the sensor rotation)
- The position on the ship does not matter
- Add the [PAM] - tag to the name
- Enable "Show sensor fields" in the K menu (info tab)



Drills / Grinders
(Only Mining & Grinding mode)
(Only when using drills aligned in different directions:)

- Add the [PAM] - tag to one or more drills which are aligned in the mining-forward direction
- Do not add the tag to drills which are aligned in the other directions
- Drills with tag are acting as reference for the "working" direction
- The sidewards aligned drills will not count in the shaft size calculation

Programmable block
- Load the script, check and run it (no timer needed)
- Run the "RESET" command if the script is in the wrong mode
- Add 3 commands to toolbar: UP, APPLY, DOWN and navigate through menus

Important:
- All blocks have to be placed on the same grid as the PB, blocks on subgrids are going to be ignored.
- Make sure your ship has enough energy to supply the thrusters with 100% in every direction
- When adding a lot of blocks then PAM has to do a lot of operations to control these blocks. The maximum amount of operations is limited by Space engineers, so you have to keep an eye on your "Max instruction count" (Its displayed in the menu: Info -> 2nd page -> Max. instructions). If you reach the limit then Space engineers will stop the script with a "Script too complex error" and your ship will drift away.
Job Setup (Mining/Grinding)
Depth Mode:

Default:
- The ship mines till the depth is reached, then it returns

Auto:
- The ship mines till the minimum depth is reached
- then it continues mining as long as the ship flies through the configured material
- Auto (Ore): continues mining if the ship mines through ores
- Auto (+Stone): continues mining if the ship mines through ores or stone

Note:
- Auto (Ore) is usable with ice
- Auto mode works with grinding ships too

Start Pos

Top-Left:
- Ship starts at the top-left corner of the job area, then it mines row by row

Center:
- Ship starts in the center of the job area, then it mines in a spiral from the center to the corners

Note:
- "Center" works best with a quadratic job area
- If the ship starts in the Bottom-Right corner then your RemoteBlock is upside down ;)
Behavior settings
Max load: [10...95]
- If the storage becomes fuller than this limit then the ship will retrun to base and unloads the resources
- Blocks which counts as usable storage: Drills/Grinders, cargo containers, cockpits & connectors

Weight limit: [on, off]
On planets:
- The script calculates a maximum weight depending on the actinng gravity, the maximum thrust and the ship orientations along the path and during the job
- If the weight exceeds the limit then the ship will retrun to base and unloads the resources

In space:
- It checks if the acceleration becomes too low because of too much load
- The acceleration limits are adjustable in the head section of the script
- If the ship becomes too heavy then it will retrun to base and unloads the resources

Unload ice: [on, off]
- if off then the ice can remain in the ship during unloading.

Ejection: [Current pos, Drop pos, In motion, Off]
- PAM does not throw out stone automatically
- PAM does not configure sorters or ejectors for you
- You need a normal independent ejection setup on your ship (sorter+ejectors) which is turned on
- PAM does only check if the stone amount in the inventory is sinking
- When the ship becomes full then it will wait till all stones was ejected
- When the ejected amount is > 25% (of total cargo) then the job will be continued without returning to base

2 material modes:
> Stone: it waits till all stones was ejected
> Stone + Ice: it waits till all stones and ice was ejected

3 movement modes:
> Current pos: Stays at the current ship position and just waits for the stone ejection
> Drop pos: Flies to a position outside of the shaft.
When there is a acting gravity it tries to not stand above the shaft (requires a min job width and height of 2!)
> In motion: Flies slowly in cycles above the shaft,
this avoids the ejector to become blocked by ejected stones.

Toggle sorters [on, Off]
- If this is enabled PAM disables the sorters as long as the ship is in the hole
- if this is disabled PAM does not toggle the sorters at all.
- Note: This does not configure the filter list for you

Uranium: [< 1 ...25, Ignore]
- if your ship uses a reactor and the uranium amount is less than this limit then the ship will return to base immediately
- every reactor on the ship must have the minimum amount of uranium.
- when the ship is docked to base and the uranium amount is less then the limit, then it will wait till the uranium was refilled.
- You can set it to ignore to disable this function
Note: PAM itself does not move uranium into the ship

Battery: [< 5 ...30, Ignore]
- if your ship uses batteries and the battery charge is less than this limit then the ship will return to base immediately
- when the ship is docked to base then it will charge the batteries to 100%
- You can set it to ignore to disable this function

Hydrogen: [< 10 ...90, Ignore]
- if your ship uses hydrogen and the hydrogen level is less than this limit then the ship will return to base immediately
- when the ship is docked to base then it will refill the tanks up to 100%
- You can set it to ignore to disable this function

When done: [Return home, stop]
- there you can choose the behavior when the job is done, either the ship will return to base or it flies to the job position

On damage: [Return home, stop, job pos, ignore]
- there you can choose the behavior when damage during the job is detected
- it detects if a block is destroyed or the health sinks below the functional level
- you can see the damage there: Main menu -> Info -> Damage

Drill inv. balancing: [on, off]
- this is for a even distribution of inventory items of the drills / grinders
- it can avoid that a single drill is overloading (and don't collect the resources) while other drills have still enough space in inventory

Enable drills: [Fwd+Bwd, Fwd]
- Fwd+Bwd: Drills are enabled while the ships flies forwards and backwards
- Fwd: Drills are enabled while the ships flies forwards

Work speed fwd: [0.5...10]
- this is the forward speed during mining or grinding

Work speed bwd: [0.5...10]
- this is the backward speed during mining or grinding

Acceleration: [10...100]
- this is a general acceleration factor for every movement that the ship will make, it affects also the negative acceleration at braking

Width / Height overlap [0...75%]
- You can define how much the holes are overlapping
- This is useful for non-rectangular shaped ships
- It will preview the new shaft size with the sensor range
- Note: This will reset the current job progress
Commands


All commands are displayed ingame when you select the programmable block. There are also examples for the CFG commands at the bottom.

NOTE: Some settings are depending on the activated script mode available or not

> Important:

[UP] Menu navigation up
[DOWN] Menu navigation down
[APPLY] Apply menu point

> Optional

[UPLOOP] UP + looping
[DOWNLOOP] DOWN + looping

[START] Start the job
[STOP] Stop every process
[CONT] Continue last job
[JOBPOS] Move to job position
[HOMEPOS] Move to home position
[PATHHOME] Record path, set home
[PATH] Record path, use old home
[UNDOCK] Starts undocking in shuttle mode

[CFGS width height depth] Set the size
[CFGB done damage] Set the behaviour
[CFGL maxload weightLimit] Set the maxload
[CFGE minUr minBat minHyd] Set the energy behaviour
[CFGW forward backward] Set the work speed
[CFGA acceleration] Set the acceleration

> Extra functions

[ALIGN] Align the ship to planet
[FULL] Simulate ship is full
[RESET] Reset data and script mode
[SHUTTLE] Activates shuttle mode

FAQ
Q: Is it possible to use the right click mode of the drills?
A: No. Its not possible to activate this mode with a script.

Q: Is it possible to use jumpdrives?
A: No. Its not possible to use jumpdrives with a script.

Q: Can you add a relative path section to navigate through a moving mothership?
A: No. This would kill the simplicity of PAM, also it wouldn't work very well because the rest of the path is still static.

Q: Could you add a combat/drone mode to PAM?
A: No. Usually i play SE without enemies, so i don't need this and so i don't add this ;)

Q: Can you make it possible to have multiple jobs configurated simultaneously and just switch between them?
A: Maybe. This would be a nice feature, but it will cause a lot of data which must be saved on the server, the data storage per PB is limited.

Troubleshooting
Sensor range does not show up
- add the [PAM] - tag to the name (it must be: [PAM], not (PAM), or PAM, or ...)
- enable "Show sensor fields" in the K menu
- it will only show up when you are in the "Setup mining job" menu

"Wrong sensor direction" is displayed
- check this for a horizontal miner (drills on the front side):
  • sensor FRONT direction = ship FORWARD direction = drills FORWARD direction
  • sensor UP direction = ship UP direction
  • sensor DOWN direction = ship DOWN direction
- check this for a vertical miner (drills on the down side):
  • sensor FRONT direction = ship DOWN direction = drills FORWARD direction
  • sensor UP direction = ship FORWARD direction
  • sensor DOWN direction = ship BACKWARD direction
If the sensor is correct aligned and the error is still there, then check the remote direction.




"Wrong remote direction" is displayed
- a wrong aligned remote can cause a lot of other errors, so make sure it is aligned correctly
- the remote must be aligned in flight direction
- the remotes down side must be facing in the same direction as your ships down side



"Script too complex" error or "Max. instructions >90%" is displayed
- THIS ERROR CAN BE CAUSED BY MODS
- E.g.: The Nanites mod is a known mod which crashes programmable blocks randomly

- Also it is possible that your ship has too much blocks, so that the script needs too much instructions to control them
- you can check the instructions count there: Menu -> Info -> 2nd Page -> Max. instructions (should be less then 20%)
- try to reducuce the block count of your ship, ecspacaly thrusters, gyroscopes and drills

"Inventory balancing failed" is displayed
- This is showed up when the script cant move items between the drills.
- Possible causes:
> Damaged conveyor
> Sorter between drills
> Not enought energy in some situations (Conveyors stop working then)
- You can disable the inventory balancing there:
Bhavior settings -> Drill inv. balancing: -> Off

"Ejection failed" is displayed
- PAM does not throw out stone automatically
- PAM does not configure sorters or ejectors for you
- You need a normal independent stone ejection setup
- PAM does only check if the stone amount in the inventory is sinking
- if the stone amount is not sinking then you get this error

Script is not compilable, unknown characters in the code
- install the latest .NET Framewok version (current version: 4.7.2.) and try again




Ship misses the home connector
- just re-set the home connector by doing this:
- dock to your connector
- select "Record path & set home"
- select "Use old path"
- select "Stop path recording"
- try again

Ship does not show up on lcd of the PAM-controller
- you need to enable broadcasting separately in the custom data of the ship and controller
352 Comments
The Third Horseman 23 hours ago 
I'm seeing a recent change in behavior since the ...204.18 update having to do with sensors.

1) Ships that had existing sensors on them and that have worked for months are getting warnings that the sensor is facing the wrong direction.

2) Removing the PAM tag will or removing the sensor itself removes that warning.

I'm including a workshop blueprint of a ship with no sensor at all that works just fine.

https://steamcommunity.com/sharedfiles/filedetails/?id=3255956399

Adding a sensor to the top of it with the arrows facing forward and tagged [PAM] results in an immediate warning that the sensor is facing the wrong direction.

Removing the [PAM] tag removes the error and does not interfere with operations at all.

Adding a sensor to the top of it with the arrows facing backward and tagged [PAM] generates no immediate error, but as soon as a mining job starts, generates a warning message that the sensor is facing the wrong direction.
Shining Light Jun 18 @ 7:19pm 
I seem to be having issues with the custom data not being set on the programmable blocks for controller mode.
Viper May 22 @ 10:06pm 
Is it possible to restart a completed job, at the moment once a job has finished it doesn't seem possible to rerun it. The asteroid would have re-spawned so the plan is to just kick the same job off again and again.
Atlantis256 May 16 @ 11:40pm 
How do I specify the width of the ship in this script? The script believes that the ship is 2 times smaller in width than it actually is, and therefore a third of the drills are not involved at all.
The Third Horseman May 9 @ 2:40pm 
@Kham - "ConnectorSmall' appears in the 1.3 code, so I'm not sure how it "didn't exist" when the script was last updated.

I sorted it out, but your answer seems . . . inaccurate . . . at best.
Nicholiae May 7 @ 8:12am 
How to get PAM miner to ignore ice in H2 Generators
spEeͥD`eͣxͫ May 4 @ 7:09am 
Are the sensors broken?
Dog In A Blender YT Mar 29 @ 3:02pm 
is there a way to turn of turning so it just goes up and down
Kham Mar 22 @ 5:39pm 
@The Third Horseman it wasn't overlooked, it didn't exist when the script was made.
The Third Horseman Mar 22 @ 5:05pm 
I'm looking at the raw code and it appears that ConnectorSmall was overlooked as an element within MyObjectBuilder_ShipConnector

/Connector
/ConnectorMedium
/ConnectorSmall

They're all valid connectors, but the code only recognizes Connector and ConnectorMedium

I'm not conversant enough with C# to make the necessary changes, but if anyone out there is, I'd be happy to test it for you.