Icaria
Not enough ratings
Useful scripts collection
By blindcoder
In this guide I will showcase my scripts that have helped me get started and understand the game.
It's my first guide ever, so your feedback is appreciated!
   
Award
Favorite
Favorited
Unfavorite
Leveling an area

To build any structures, the ground must be level, and noone wants to do that manually. This script levels the area of a beacon to the height defined by another beacon, and then parks the drone in a third one.
Note that you need a container to dump the soil in to, I used my WIP Logistics network with a medium storage container as the destination. It's a role called "LogisticBuffer" but you can use any storage container you have.
  • Go to my team area "LevelReferenceHeight" and store in #
    I use a 1x1 beacon to define the target height.
  • Go to highest point in my team area "LevelMe"
  • While above area stored in #
    • Dig
    • if my storage (* anything) > 0
      • Go to random team, random entity storage "LogisticInput"
    • On fail
      • Go to random point in my team area "Parking"
      • Stop execution
    • Give
    • Go to highest point in my team area "LevelMe"
    Every tile in the area "LevelMe" is now at or below the height of "LevelReferenceHeight"
  • While below area stored in #
    • Go to random team storage "LogisticBuffer"
      Here is where I store everything, adjust this to your setup
    • Take specific item "Mudrock"
      Adjust this to whatever you want to fill up areas with.
    • On fail
      • Go to random point in my team area "Parking"
      • Stop execution
    • Go to lowest point in my team area "LevelMe"
    • Deposit
    • Go to lowest point in my team area "LevelMe"
  • Go to random point in my team area "Parking"

    The entire area is now flat. There may be a few spots that got additional stuff deposited. To address this, either let one drone flatten the area again, or you can do a check around "Deposit":

  • if below area stored in #
    • Deposit
Building a ramp

Carrying items by drone early on is not efficient, but conveyor belts can only cross terrain with a single tile height difference. This script will build a ramp towards the North from a starting reference point to a target height reference. When the ramp is finished, you can build a conveyor belt on it.
You will need a container with soil to pick up from, I used a medium storage container from my WIP logistic network containing a lot of mudrock for the ramp.
When the ramp is finished, it will return to a parking beacon.
The drone and beacons must be the same team colour.
Planting Trees
Update: Plant Trees v2
This script fixes some issues of the previous one: No longer leaves the beacon area and properly addresses having seeds in the inventory, as well as parking when sleeping.

  • Go to my area "PlantTrees (Details: Nearest Entity, Nearest location)
  • While my distance to PlantTrees <= 0
    • Go to South:1 East:0 (Move 1 tile south relative to drone)
    Drone has now left the PlantTrees area
  • Go to North:1 East:0 (Move 1 tile north, back into PlantTrees area)
  • While my distance to PlantTrees <= 0
    • Go to North:0 East:1 (Move 1 tile west relative to drone)
    Drone has now left the PlantTrees area
  • Go to North:0 West:1
    Drone is now in the south-east corner of PlantTrees area
  • Remember current location to #
  • Remember current location to @
  • While forever
    • While my distance to PlantTrees <= 0
      • if storage (* anything) <= 0
        If storage is empty
        • Move to my team storage "SeedsAndTools"
        • Take specific seed
        • On fail
          • Go to random location in my team beacon "Parking"
          • Rest for 1 minute
          • Restart action from beginning
          • Stop (leftover code, can be removed]
      • Go to remembered location @
      • While forever
        • Plant seed
        • On Fail
          • Move North:0 West:1 (move 1 tile west)
        • if storage (* anything) = 0
          Planting was successful
          • Break loop
        • if my distance to "PlantTrees" > 0
          Left PlantTrees area
          • Break loop
    • Go to remembered location #
    • Move North:3 East:0 and save to #
    • Remember current location in @
    • if my distance to "PlantTrees" > 1
      Left PlantTrees area
      • Move to my team storage "SeedsAndTools"
      • Give item
      • Go to random location in my team area "Parking"
      • Rest for 1 minute
      • Restart action from beginning
Surveying for resources

This is an action for a surveyor to search for resources to the north and east. The surveyor will remain mostly in radio range, return when the battery is low, and return to the lander when leaving radio range.
  • Go to lander
  • Loop forever
  • While my battery charge is > 60%
    This is so the surveyor can safely return
    • Move 10 meters east
    • Search for resources
      Here I search for hematite, bog rock, iron ore and pyrite
    • On Success
    • Drop beacon with role "MineStart" and assign to yellow team
      This is picked up by mining drones
  • End On Success
  • If distance to any lander is > 120 meters
    Lander has 100 meters radio range. Further testing showed that > 60 is better here.
    • If distance to any beacon is > 80 meters
      Beacons have 75 meters radio range. Further testing showed that > 60 is better here.
      • Break loop
    • End if
  • End if
  • Go to Lander
    for recharging
  • Go to remembered position "#"
  • Move 10 meters north and remember in "#"
  • If distance to any lander is > 120 meters
    Lander has 100 meters radio range. Further testing showed that > 60 is better here.
    • If distance to any beacon is > 80 meters
      Beacons have 75 meters radio range. Further testing showed that > 60 is better here.
      • Return to Lander
      • Stop execution
    • End if
  • End if
Fulfilling requests without belts
Here is a complex setup where buildings can request items from drones instead of having them delivered by belts. This enables remote locations to have materials without having to flatten the entire map.

Setup the building
We'll use an x-y switch for the building.
Low storage trigger
First you'll need a trigger when the storage runs below a lower bound. For my bioreactors, that is currently 3 units of coke.

  • When storage of coke is less than three
    This triggers this action whenever storage reaches low threshhold.
  • Set request to 6 coke
    In the details I set "do not reserve" and "replace individual items only"
  • Reprogram to BeltlessRequester -> RequestCokeLoop
Main request loop
The main loop continuously requests a drone to deliver items until a drone responds.

  • When signal received: BioReactorRequestDone
    This signal is received when the drone finishes delivery.
  • While storage of coke is less than 6
    This is a safety guard exit condition.
    • Signal BioReactorRequest
      In the details I set "Select Entity" to "Random", "any Team" and "Within Range" to "anywhere".
    • On Success -> Stop
      If a drone received the signal, we wait for its delivery. That means only one drone can deliver at any time, but also means we can scale up. If we ever get proper "For" loops, I'll revisit this.
    • On Fail -> Rest 5 seconds
      All drones are busy, we wait for one to become free.
High storage trigger
When the storage reaches the high threshhold, we stop requesting.

  • When storage of coke >= 6
    Trigger when storage reaches high threshhold. It must be "larger than or equal", the screenshot is wrong.
  • Request nothing
    Here I replace everything.
  • Reprogram BeltlessRequester
    No action in the details. This terminates the request until storage falls below low threshhold.

Setup the drones
The building now requests materials, now we need to program the drones to deliver it.
Signal received

  • When signal received "BioReactorRequest"
    Trigger this action when a Bio Reactor requests something. In the details set "Remember" to "save => #"
  • Go To "LogisticBuffer"
    In the details I set Random, anywhere, any team. These buildings store all my materials that are not requested by anything else. It's only important that it stores the things the buildings request.
  • Search for item requested
    In the details set "Search for items requested by a building" to "stored in # memory", Take "Override reservation" and "Where to search" to "Building Storage".
  • Take advertised item
    In the details set "Take items requested by a building" to "stored in # memory" and Take "Override reservation".
  • On Success
    If we got the item, we deliver it.
    • Go to
      Set "Go to a remembered location" to "stored in # memory".
    • Give
      Whatever we have, we deliver it.
  • Signal "BioReactorRequestDone"
    Tell the reactor we are done delivering. This does NOT indicate success or failure, just that we're done and the building should start checking again. Select "Entity" as "#" and team as "any team".
  • Go To "Parking"
    I have parking beacons set up for all teams. Here I just send the drone back to it.

And that's it. You can scale this up by adding more drones, depending on how active your requesters are. It's complex, but it hasn't clogged up for me yet.
10 Comments
blindcoder  [author] 24 Jul @ 10:23pm 
@CptVodka: I completely revamped the action with inspiration from your action. Thank you very much!
blindcoder  [author] 24 Jul @ 4:57am 
Oooh, very cool! I'll definately check that!
CptVodka 24 Jul @ 4:36am 
In this script:
Lander #1 is the drop off space
Medium storage #6 is seed storage
During ElseIF - N3 E0 it will save its position to @

The planting area here is 19x12. To change into desired size, the IF and ElseIF has to have their variables changed as well as the ElseIF - N0 E21 (into plotsize +2)
Same as with your script, it's started at bottom right corner.. However that differs depending on how your camera is set i suppose :P

If you like it, feel free to use it in the guide :)
CptVodka 24 Jul @ 4:36am 
I think i cracked the code:

https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=3533195102

https://gtm.steamproxy.vip/sharedfiles/filedetails/?id=3533194709

This script is longer, slower and requires a bit more to setup, but it also comes with some redunancy. For example i can start it with a seed inside, and it'll start right away, or even an item that isn't a seed, and it'll move that to a drop off location before starting the planting session.
Whenever it's done with its assigned space, or can't fetch more seeds, it'll go into parking mode, going back to a pre-designated parking space. If it's done, it will also drop the seed back into the container before going to the parking space.
blindcoder  [author] 24 Jul @ 1:49am 
Ah, you're right, it actually keeps planting until it runs out of seeds. I may need to revisit this script in it's entirety...
CptVodka 24 Jul @ 1:41am 
Doesn't work for me, and i'm not sure how it would work logically either.
At the second last command, "Move to N:3 E:0" the script is storing a new position in #, which means that it will go on for an infinite amount of rows, while still being within 20 of #.


Another problem i encountered was that if the script encountered a tree at the last position in a row, it wouldn't be able to plant and thus wouldn't encounter the loop-break of storage=0, which would make it go outside of the area.
For me, due to my planting area being next to a mountain.. It couldn't plant anywhere before the other side of the mountain.. :P
It seems that if the script is within a loop, it doesn't adhere to any requirements of the parent loop
I solved that issue with another If statement to check "my distance to # > 19 meter.
blindcoder  [author] 24 Jul @ 1:17am 
CptVodka: The "while distance to # < 20 m" makes sure that the drone only plants within an area 20m long and wide.
CptVodka 23 Jul @ 11:44pm 
The planting script.. How do you prevent it from going outside of the planting area?
blindcoder  [author] 22 Jul @ 10:52am 
Working on a beltless request system using signals, requesters, buffer chests and drones. Probably tomorrow!
IceArrowftw 19 Jul @ 10:44pm 
Very useful, thanks for sharing!