A Sliver of Tips and Tricks

A Sliver of Tips and Tricks

Overview

The use of this guide is point out a few of the ways to improve the actions of your bots. This is mostly pointing out ways to improve scripting, but can include other methods of improvement as time goes on.

Stacks


A Sliver of Tips and Tricks image 3

You could have your Bots move to a spot and drop all, forever. This can work for when you need storage, but should be avoided whenever possible.

Speed Tips


A Sliver of Tips and Tricks image 6
A Sliver of Tips and Tricks image 7
A Sliver of Tips and Tricks image 8
A Sliver of Tips and Tricks image 9

Scripting in Autonauts runs at about 1 line per second. this means that when loops are involved, each line in the loop will run, even if nothing happens. This means that for faster scripts, only put code you need repeated inside the loops.

In this example, you can see that the 'Add to Storage' is inside a loop, while the move is outside. this will make the bot take about 1/2 the time of a bot that has a 'Move to Storage' and 'Add to Storage' in it's loop.

NOTE: objects on ground need a 'find' before it is treated like an object. this means that you could have a 'find' and 'pickup' loop, but unless you are standing on the object, it would fail without a move between them.

Collecting until Full, OR until no more available:

The check boxes next to each loop in the script (like the forever loop, or until full) is for when the code fails. in this example, it will collect until hands are full, OR until no more goods to pick up. The second part of this code will store the good, OR leave to pick up more if storage does not accept goods (like wrong storage or is full).

NOTE: this means the bot could have an unknown object in its hands. as long as the bot NEVER carries more then 1 type of object, this code will work great. an alternative is to have 'until hands empty' with the box unchecked. this keeps the bot from moving until hands are empty, but a loop within a loop can be effected by both loops, so try not to move multiple types of goods with the same bot.

NOTE 2: in my example the move was still in a loop, so this could be better. Also, I had the bot moving to a specific spot, allowing me to know when the storage was full. (also, no check in box for if storage full loop, as I have yet to find a gain from doing so.)

How to use the backpack, and save code:

Retrieve is a line of code that tells the bot to grab the object stored in its backpack if hands are empty. This means that if its hands are full, nothing happens. This example allows a bot to store 5 items, with one being different, then use all 5 on a crude pot for cooking.

NOTE: This is for a recipe, so the specific number of ingredients was needed, so no boxes are checked. this could also be changed to only having the 'Add to Storage' and 'Retrieve' as below

Building Tricks


A Sliver of Tips and Tricks image 21
A Sliver of Tips and Tricks image 22
A Sliver of Tips and Tricks image 23
A Sliver of Tips and Tricks image 24
A Sliver of Tips and Tricks image 25
A Sliver of Tips and Tricks image 26

#1:

You can have your bots build everything! (The if is when building stuff for spaceport, this is remade when needed, and ignored otherwise)

#2:

You can move buildings easily, even with resources on them.

#3:

You can get pre-built buildings, and instantly place them! (see #4)

#4:

You cannot get rid of buildings. so what does the trash can do to fully built buildings? it stores them if their empty! (see #3)

#5:

With Move selected on building screen, you can drag over multiple buildings (and walls/floors) and move them all as one!... you do need enough room for it all though.

(this also works with bridges, so it is possible to cross deep water with only 2 bridge pieces)

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2152554762					

More Autonauts guilds