Instructions

From Desynced Wiki
Instructions Directory Components Directory Items Directory

An instruction is a node within behavior programming. Pins are the small connecting points the edges. The squares are inputs/outputs for data processed by an instruction. If any data is evaluated, there will be multiple pins on the right hand side which dictate where the behavior will proceed next. An unlinked pin will return the behavior to the start.

Refer to Guides#Behavior_Guides for some in-depth implementations of instructions.

Below is a list of all instructions available in-game.

Math

Add Adds a number or coordinate to another number or coordinate
Check space for item Checks if free space is available for an item and amount
Combine Coordinate Returns a coordinate made from x and y values
Combine Register Combine to make a register from separate parameters
Compare Number Divert program depending on number of Value and Compare
Copy Copy a value to a frame register, parameter or variable
Divide Divides a number or coordinate from another number or coordinate
Get Battery Gets the value of the Battery level as a percent
Get Entity At Gets the best matching entity at a coordinate
Get from Component Reads a value from a component register
Get Grid Efficiency Gets the value of the Grid Efficiency as a percent
Get Health Gets a units health as a percentage, current and max
Get Resource Num Gets the amount of resource
Get Self Gets the value of the Unit executing the behavior
Get space for item Returns how many of the input item can fit in the inventory
Is Working Checks whether a particular component is currently working
Modulo Get the remainder of a division
Multiply Multiplies a number or coordinate from another number or coordinate
Separate Coordinate Split a coordinate into x and y values
Separate Register Split a register into separate parameters
Set Number Sets the numerical/coordinate part of a value
Set to Component Writes a value into a component register
Subtract Subtracts a number or coordinate from another number or coordinate

Component

Mine Mines a single resource
Radar Scan for the closest unit that matches the filters
Set Signpost Set the signpost to specific text

Global

Can Produce Returns if a unit can produce an item
Distance Returns distance to a unit
Faction Item Amount Counts the number of the passed item in your logistics network
Get Home Gets the factions home unit
Get Ingredients Returns the ingredients required to produce an item
Get Location Gets location of a a seen entity
Get Stability Gets the current world stability
Get Trust Gets the trust level of the unit towards you
Get Type Gets the type from an item or entity
Is Day/Night Divert program depending time of day
Land Tells a satellite that has been launched to land
Launch Launches a satellite if equipped on an AMAC
Lookat Turns the unit to look at a unit or a coordinate
Notify Triggers a faction notification
Percent Gives you the percent that value is of Max Value
Pings a Unit Plays the Ping effect and notifies other players
Place Construction Places a construction site for a specific structure
Produce Unit Sets a production component to produce a blueprint
Read Key Attempts to reads the internal key of the unit
Remap Remaps a value between two ranges
Resource Type Gets the resource type from an resource node

Move

*Move Unit (Range)* *DEPRECATED* Use Move Unit
Move Away (Range) Moves out of range of another unit
Move East Moves towards a tile East of the current location at the specified distance
Move North Moves towards a tile North of the current location at the specified distance
Move South Moves towards a tile South of the current location at the specified distance
Move Unit Moves to another unit or within a range of another unit
Move Unit (Async) Move to another unit while continuing the program
Move West Moves towards a tile West of the current location at the specified distance
Scout Moves in a scouting pattern around the factions home location
Stop Unit Stop movement and abort what is currently controlling the entities movement

Unit

Check Altitude Divert program depending on location of a unit
Check Battery Checks the Battery level of a unit
Check Blightness Divert program depending on location of a unit
Check Grid Efficiency Checks the Efficiency of the power grid the unit is on
Check Health Check a units health
Connect Connects Units from Logistics Network
Count Items Counts the number of the passed item in its inventory
Count Slots Returns the number of slots in this unit of the given type
Disable Transport Route Disable Unit to deliver on transport route
Disconnect Disconnects Units from Logistics Network
Drop Off Items Drop off items at a unit or destination

If a number is set it will drop off an amount to fill the target unit up to that amount If unset it will try to drop off everything.

Enable Transport Route Enable Unit to deliver on transport route
Equip Component Equips a component if it exists
First Item Reads the first item in your inventory
Fix Item Slots Fix all storage slots or a specific item slot index
Get Closest Entity Gets the closest visible entity matching a filter
Get First Locked Id Gets the first item where the locked slot exists but there is no item in it
Get Inventory Item Reads the item contained in the specified slot index
Is Equipped Check if a specific component has been equipped
Is Fixed Check if a specific item slot index is fixed
Is Moving Checks the movement state of an entity
Is Same Grid Checks if two entities are in the same power grid
Lock Itemslot Lock a specific itemslot index, a range of slot index via coord, or all storage slots
Match Filters the passed entity
Order to Shared Storage Request Inventory to be sent to nearest shared storage with corresponding locked slots
Order Transfer To Transfers an Item to another Unit
Package All Tries to pack all packable units into items
Pick Up Items Picks up a specific number of items from an entity

Will try to pick up the specified amount, if no amount is specified it will try to pick up everything.

Read Radio Reads the Radio signal on a specified band
Read Signal Reads the Signal register of another unit
Request Item Requests an item if it doesn't exist in the inventory
Request Wait Requests an item and waits until it exists in inventory
Solve Explorable Attempt to solve explorable with inventory items
Sort Storage Sorts Storage Containers on Unit
Switch Filters the passed entity
Turn Off Shuts down the power of the Unit
Turn On Turns on the power of the Unit
Unequip Component Unequips a component if it exists
Unfix Item Slots Unfix all inventory slots or a specific item slot index
Unlock Itemslot Unlock a specific itemslot index, a range of slot index via coord, or all storage slots
Unpackage All Tries to unpack all packaged items

Flow

*Loop Signal* *DEPRECATED* Use Loop Signal (Match) instead
Break Break out of a loop
call
Clear Research Clears a research from queue, or entire queue if no tech passed
Compare Entity Compares Entities
Compare Item Compares Item or Unit type
Data type switch Switch based on type of value
Exit Stops execution of the behavior
Get Max Stack Returns the amount an item can stack to
Get Research Returns the first active research tech
Have Item Checks if you have at least a specified amount of an item
Is a Compares if an item of entity is of a specific type
Jump Jumps execution to label with the same label id
Label Labels can be jumped to from anywhere in a behavior
Lock Run one instruction at a time
Loop Entities (Range) Performs code for all entities in visibility range of the unit
Loop Inventory Slots Loops through Inventory
Loop Recipe Ingredients Loops through Ingredients
Loop Research Performs code for all researchable tech
Loop Signal (Match) Loops through all units with a signal of similar type
Select Nearest Branches based on which unit is closer, optional branches for closer unit
Set Research Returns the first active research tech
Unit Type Divert program depending on unit type
Unlock Run as many instructions as possible. Use wait instructions to throttle execution.
Wait Ticks Pauses execution of the behavior until 1 or more ticks later (5 ticks=1 second)


For raw data on instructions: Refer to this data on instructions broken down into a table format.