Controlling Units

9/2/2025, 6:14:29 AM
  • @unit
    Can only store 1 unit at any given time, stores the unit reference, like building reference, unit reference are different from each other, even the same type

  • Binding
    unlike the name say, unit bind instruction itself does not bind, unit control, unit radar, unit locate are what binds unit.
    unit bind just gets a unit's reference and puts it in a variable called @unit
    altalt If you hover your mouse on either the unit or the processor you will see a yellow box showing what unit the processor is binding or what processor the unit is binded to, this is called Binded, meaning the unit is now in full control of the processor, you cannot give it commands anymore using the RTS Commands, the only way to get the unit back is either control(posses) the unit or unbind it which can be done with either destroying the processor, or altering the processor code, units will also be automatically un-binded after 10 seconds with no unit control, unit radar, and unit locate instruction received, this applies regardless even if the unit is still in the middle of doing something
    A unit that is currently controlled(possesed) by the player can also be "bound" but only to retrieve data from it; controlling is not possible.

  • Boosting
    Some ground units can boost, boosting allows them to fly over anything air units can, albeit slower, these units are: Nova, Pulsar, Quasar, and Vela

  • Payload
    Payload is a block/unit that is not physically placed in the world, they are either on a conveyor or picked up by unit,
    however if you save its reference prior to making it a payload up you can still sensor data from it like @x and @y, although @dead will be true.
    unit’s payload capacity can be found in-game’s info menu
    Example: 3x3 means the unit can carry 9 of 1x1 blocks, 2 of 2x2 blocks and, 1 of 3x3 blocks
    for units its the same, a mace size is 1.25 x 1.25 meaning it will take 1.5625 block worth of space as payload

Unit Bind

Bind 1 unit and put its reference in the @unit variable,
When binding a unit @[type] (using content name) it will bind in an order
the order of bind is determined by how old it is, the first unit alive will be binded first and the most recent unit is last
When looped (meaning the unit bind instruction is run again) it will bind the next unit in the order, when it reach the end it will go back and bind the first order
Here’s a visualization : the red box indicates that the unit is in the @unit variable
altDon’t worry about instruction line 1,2,3, they are there just to make the code not 1 instruction, to more easily visualize it.
Let’s say the first mega reference mega#1, when mega#1 is binded it store the reference in @unit meaning @unit is now mega#1, and so on with mega#2, 3, 4, ...

Unit bind can also be used with a variable that stores a unit reference to bind that specific unit directly,
for example the radar instruction can output a unit reference to a variable, you can use that variable for ubind,
another example after binding a @[type] with ubind you can save @unit to another variable, then rebind that unit with the variable

Unit Control

Unit control, controls one unit in the @unit variable, a common misconception is that it controls all binded unit, this is wrong, it might seem that way because processor loops, everytime it loops ubind it binds a new unit and controls it, it does this very fast that it looks like its controlling all unit at once.
and a second common misconception is that Unit control wait for completion before running the next unit control, this is also wrong, Like the visualization you see above, the processor doesn’t care what instruction you put in it, it will just run it regardless, it is not smart, you have to specify it yourself.

  • Move
    Move the unit to the specified coordinates in a straight line Once the instruction is run it will move to that coordinates even if you immediately remove the instruction, its similar to RTS controls (shift clicking and left click to move unit to the cursor location)

  • altApproach
    Similar to move but it has a radius, the unit will stop at the radius

  • altaltpathFind
    Path find to the specified location Usually used with grounded units as Move moves the unit in a straight line and grounded units can get stuck in buildings If the specified location is inside a building or invalid the unit will not move, they will stay in place

  • autoPathFind
    Automatically pathfinds to the nearest enemy core or drop point.
    This is the same as standard wave enemy pathfinding

  • Idle
    Stop moving, but keep building/mining, the default state

  • Stop
    Stop moving, mining, and building

  • Boost
    Enable boosting, boolean, 1 = boost, 0 = don’t boost. cannot be disabled if boosted unit cannot land (on top of blocks/buildings)

  • Target
    Shoot a coordinate position, boolean, 1 = shoot, 0 = stop shooting
    altTargetP
    Same as target but shoot a unit reference instead and with velocity prediction

  • ItemDrop
    Drops items the unit is currently carrying to the specified location
    altto a building reference
    amount is how many to drop
    Unit have to be within (5.625 + [block size] / 2) tiles of the targeted block (from the middle), else it does nothing
    Can also drop to @air which will discard the item anywhere
    to drop everything just put a large number like 999
    Unit has an interaction limit of 1,5 seconds, meaning it can only take/drop item every 1,5 seconds

  • ItemTake
    Takes items from the specified building to the unit, unit’s item capacity can be found in-game’s info menu,
    from a building reference
    amount is how many to take
    a unit can only carry 1 type item at a time
    Unit have to be within 5.625 + [block size] / 2 tiles of the targeted block (from the middle), else it does nothing,
    to take the maximum amount the unit can take just put a large number like 999,
    Unit has an interaction limit of 1.5 seconds, meaning it can only take/drop item every 1.5 seconds.

  • PayDrop
    Drop payload at current location.

  • PayTake
    Pick up a block or a unit at current location and turn it into a payload
    if multiple blocks/unit is below the taker location it will take block/unit that is closest to the taker location (taker @x and @y)
    for example a unit taker location is exactly at 10,10 , there's 2 unit below it at 9.8,10 and 9.9,10 , when using paytake it will take the 9.9,10 unit

  • PayEnter
    Land/enter on a building directly below the unit, that accept payload, like reconstructor

  • Mine
    Mine a coordinate position, if out of range or not mineable will do nothing

  • Build
    Build a block at specified location, if out of range or invalid will do nothing
    altx, y is build location
    block is what block to build, Content name
    rotation is what orientation the block is built, 0 is right, 1 is up, 2 is left, and 3 is down
    Config, configuration of blocks, eg, if @copper when building a sorter will set the sorter to @copper. Additionally can be a building reference, eg, if @this when building a processor will copy @this processor’s code to the built processor

  • getBlock
    Gets a block at a specified location, outputs will be null if out of range
    altx, y is coordinate location to get the block
    type is an output, it will output the type of block to the variable
    building is an output, it will output the building reference to the variable
    floor is an output, it will output the type of floor to the variable

    the range of getblock is max(27.5, {unit's range})
    which means takes the highest number between the two

    when getBlock-ing a cell,bank, or a display you can still write/draw to them even if the unit is no longer present, only the building reference is needed for these blocks, this means you can get them once and then unbind/move the unit your variable of building will remain until either you overwrite it or the processor is refreshed.
    however you can't enable/disable or config getBlock-ed buildings,

  • Within
    Check if unit is within a position with a radius
    altx,y is coordinate location to check if unit is within that coordinate
    radius is the radius of the within
    returns boolean
    result is the result, 0 / 1, true / false
    Example: (the @unit variable is mega shown on the picture)
    altaltaltIn this two scenario, the first picture will have the variable result true because the unit is within the circle, while the second picture is false because it is outside the circle

  • Flag
    Gives the unit a numeric flag, essentially assigning a number to a unit, this number serves no purpose other than being read, what you do with the number is up to you
    the flag "lives" in the unit, meaning a unit will permanently retains its flag until written again, even if the processor is destroyed
    Unit default flag is 0
    a unit can only store 1 numeric flag
    The largest integer that can be stored in a single flag is related to integer limitations

Unit Radar

altUnit radar locates other unit around the @unit unit within the unit’s range (information can be found in-game’s info menu)
target is a filter of what category of unit it will radar, enemy means it will radar enemy units
Order is sorting order, ascending or descending, can only be 0 or 1
sort is a metric to sort results by, distance means it will get unit by distance
Since order is 1, the unit gotten is the closest to that @unit’s unit
Will output the unit reference to result.
sort distance order 1 = closest, 0 = furthest
sort health, maxHealth, armor, shield order 1 = highest, 0 = lowest

Unit Locate

Locates the nearest building/ore/spawn to the unit without needing to be in the unit’s range, but limited to what it can locates

  • Building
    Will locate a building of the selected group, in this case, core,
    altFind what group to find, TO ADD#1
    Enemy is whether to locate enemy building’s or not, true means it will locate enemy’s building, false means it will locate ally building
    outX and outY are the building’s output coordinates
    Found is an output on whether the building is found(exist in the map) or not, true means it is found, false means it is not found
    Building is an output of that building reference, if locating for enemy blocks, will only return if that building is within max(27.5,{unit's range}) of the unit, if locating for ally blocks, will return that building regardless, else will return null instead

  • Ore
    Will locate an ore of the selected type, in this case @copper
    altFind what group to find
    Ore what ore to find, takes Content name
    outX and outY are the tile's output coordinates
    Found is an output on whether the tile is found(exist in the map) or not, true means it is found, false means it is not found
    May not consistently return the closest tile, but will always return the closest "vein"

  • Spawn
    Will locate an enemy spawn point, may be a core or a position

  • Damaged
    Will locate an ally damaged building