Tag Binding

**Tag bindings** are found in the Drone Workshop, and are activated by clicking on the TAG button in the top menu.

They are necessary for building anything more than the most simple of drones.

As can be seen on the right, the 'TAG button' shows or hides a field next to the Inputs and Output of Drone Parts. By default, one uses a key value (eg the keypress 'A') for as an input or an output.

But when we develop more complex logic, and larger drones, we will quickly run out of keys, **and** we will have the additional problem of relating a given key to a specific sequence.

However, a TAG binding allows us to use a specific name for the input/output - instead of it being a keypress, it's just a name which is used to refer to the connection between inputs and outputs.

We can then use our own names for the connection, without having to worry about finding or choosing a specific key. The names can have spaces and symbols, but they are case-insensitive (capital letters are the same as non-capital letters).

(It often helps to have no key binding when using a Tag Binding. A key binding can be deleted by using the Escape key when being prompted to change it).

## Example

### Iterations

On the right is a drone factory which will generate exactly 4 drones.

The top line is a Logic Splitter, indicating that the entire factory system is self-standing.
Below that is a Button which will provide a continuous signal.
Then the Factory Part, which will generate the drone hanging below it.
The drone itself is tiny: just a Small Fuel Tank and a Small Thruster.
The iterator logic hangs to the right of the Factory Part. (Note that it is connected to the button, not the factory! We don't want to reproduce it!). It's a 4-stack of an XNor Gate, three Switches, and a Not Gate, with a Distance Sensor just long enough to sense the presence of the factory Drone, and is set to detect "Own Drone".

#### The TAG bindings

* Button has the Output "GO".
* Factory Part uses "GO" for Decouple input, and "BUILD" for the Print input.
* Small Thruster uses "GO" for the Activate input.
* Distance Sensor uses "Drone Docked" for Detection input.
* Not Gate uses "Drone Docked" for its Input and "SW0" for its output.
* Lower switch uses "SW0" for its Toggle input, and "SW1" for its Activate.
* Middle switch uses "SW1" for its Toggle input, and "SW2" for its Activate.
* Upper switch uses "SW2" for its Toggle input, and "SW3" for its Activate.
* XNor gate uses "GO" for its first input, "SW3" for its second input, and "BUILD" for its output.
* The XNor gate output acts to show if the factory is currently active.

#### What happens

(The movie shows from drone 2 to drone 4)

Immediately the Button is set to "GO".

1. The Factory decouples the drone, and the drone activates (Both of them are tied to GO). (This is Drone 1)
2. As soon as the drone is clear of the sensor, the sensor de-activates "Drone Docked".
3. The Not gate, having received an inactive "Drone Docked" activates SW0.
4. The Lower Switch is toggled (SW0 toggles it) and **activates** SW1.
5. The Upper Switch is toggled (SW1 toggles it) and **activates** SW2.
6. The Upper Switch is toggled (SW2 toggles it) and **activates** SW3.
7. The XNor sees GO (always on) and "SW3" are now the same and activates BUILD.
8. BUILD invokes the factory to build a new drone.
9. Once the drone is built, the sensor is activated "Drone Docked".
10. This de-activates the Not gate, which no longer pushes the Switch toggle.
11. As soon as the drone is built, GO decouples and activates it again. (as in step 2) This is Drone 2.
12. The Not gate, having received an inactive "Drone Docked" activates SW0 (as in step 3)
13. The Lower Switch is toggled (SW0 toggles it) again which **de-activates** SW1.
14. As GO and SW3 are unchanged, the XNor continues to activate BUILD.
15. Everything is repeated until the Lower Switch is toggled by Drone 3 flying off.
16. The Middle Switch is toggled (SW1 toggles it) and **de-activates** SW2.
17. Everything is repeated again until the Lower Switch is toggled by Drone 4 flying off
18. The Middle Switch is toggled (SW1 toggles it) and **activates** SW2.
19. The Upper Switch is toggled (SW2 toggles it) and **activates** SW3.
20. Now that SW3 and GO are different, the XNOR no longer activates BUILD, and the factory ceases to produce drones.