Instructions/Set to Component

From Desynced Wiki
Revision as of 06:14, 17 September 2023 by Johan (talk | contribs) (→‎Uses)


Set to Component
     
     Writes a value into a component register
Lua ID set_comp_reg
Category Math
Icon Set Component Reg.png
Argument One: Type Input
Argument One: Name Value
Argument One: Description Value to set
Argument One: Data Type any
Argument Two: Type Input
Argument Two: Name To
Argument Two: Description Component and register number to set
Argument Two: Data Type comp_num
Argument Three: Type Input
Argument Three: Name Component Index
Argument Three: Description Component index if multiple are equipped
Argument Three: Data Type num



Description

Used to set a value to a component register with a specified index.

Uses

Can typically be used to set a Turret, Repair Component, Deconstructor or Miner to a specific target, but for Radar, it is probably advisable to use the Radar instruction instead.

0 and 1 are both treated as index 1.

A component seldom has multiple input registers, but for the few that exist, any number from 1 - n can be used to specify what index to write data to.

File:ExampleComponentIndex.PNG

In its most dynamic usage, it can be used to write directly to the parameters from another Behavior Controller, which can have a theoretically infinite amount of parameters.

Similar Instructions

Get from Component, Radar, Mine