[prefix{l}]Programmer [prefix{}]

The Programmer is a block used to program [link{item/drone}]Drones [link{}]. This is done in a rather natural way: With puzzle pieces.
[crafting{200,70,key=block/programmer}]











When you open up the interface of the Programmer you'll see something like the following:
[image{200,200,0.20,pneumaticcraft:textures/wiki/programmerGUI.png}]




















On the right you can see a list of all available puzzle pieces. There are multiple pages of these. To begin, drag a 'Start' puzzle piece to somewhere on the screen. This is where every program starts. As you can see in the image, you can connect puzzle pieces. Let's explain what happens here:
-The program starts at the 'Start' piece.
-The program will perform the 'Inv-I' (Inventory Import) program. It has an 'Area' puzzle piece connected to it, which specifies where it should import items from.
-The program will perform the 'Dig' program. The connected 'Area' piece specifies where to place. On the left of this piece an 'Item Filter' piece is connected. This tells the 'Dig' piece that it should not dig Oak Wood blocks. It is allowed to dig anything else.

So vertically placed pieces are executed sequentially. Whether the Drone should execute the current program or move on to the next is dependent upon one condition: When the current running program is done. For every puzzle piece this is different, this will be explained.

Horizontally placed pieces are parameters for the 'main' pieces (pieces that have a vertical input/output). These can be things like area's, item filters or texts. When each of these are placed on the right, this means it'll be added, whitelisted, to the piece. When placed on the left it will be blacklisted. for instance, if you have a Drone that you want to have attack every player but yourself, you could place a 'Text' piece on the right with '@player' (meaning every player). Then you place a 'Text' piece on the left with your player name. So every player will be added (on the right), and you will be subtracted (from the left).

The following is a list of all the different Programming Puzzles:
[link{pneumaticcraft:progwidget/start}]-Start [link{}]
[link{pneumaticcraft:progwidget/inventoryExport}]-Export items to inventories [link{}]
[link{pneumaticcraft:progwidget/inventoryImport}]-Import items from inventories [link{}]
[link{pneumaticcraft:progwidget/liquidExport}]-Export liquids to tanks [link{}]
[link{pneumaticcraft:progwidget/liquidImport}]-Import liquids from tanks [link{}]
[link{pneumaticcraft:progwidget/entityExport}]-Export Entity [link{}]
[link{pneumaticcraft:progwidget/entityImport}]-Import Entity [link{}]
[link{pneumaticcraft:progwidget/pickupItem}]-Pick up items [link{}]
[link{pneumaticcraft:progwidget/dropItem}]-Drop items [link{}]
[link{pneumaticcraft:progwidget/dig}]-Dig Blocks [link{}]
[link{pneumaticcraft:progwidget/place}]-Place blocks [link{}]
[link{pneumaticcraft:progwidget/blockRightClick}]-Right Click Blocks [link{}]
[link{pneumaticcraft:progwidget/entityRightClick}]-Right Click Entities [link{}]
[link{pneumaticcraft:progwidget/goto}]-Go To Location [link{}]
[link{pneumaticcraft:progwidget/teleport}]-Teleport To Location [link{}]
[link{pneumaticcraft:progwidget/entityAttack}]-Entity Attack [link{}]
[link{pneumaticcraft:progwidget/emitRedstone}]-Emit Redstone[link{}]
[link{pneumaticcraft:progwidget/itemFilter}]-Item Filter [link{}]
[link{pneumaticcraft:progwidget/liquidFilter}]-Liquid Filter [link{}]
[link{pneumaticcraft:progwidget/area}]-Area [link{}]
[link{pneumaticcraft:progwidget/text}]-Text [link{}]
[link{pneumaticcraft:progwidget/jump}]-Jump [link{}]
[link{pneumaticcraft:progwidget/label}]-Label [link{}]
[link{pneumaticcraft:progwidget/wait}]-Wait [link{}]
[link{pneumaticcraft:progwidget/rename}]-Rename Drone [link{}]
[link{pneumaticcraft:progwidget/suicide}]-Suicide [link{}]
[link{pneumaticcraft:progwidget/externalProgram}]-External Program [link{}]
[link{pneumaticcraft:progwidget/coordinate}]-Coordinate [link{}]
[link{pneumaticcraft:progwidget/coordinateOperator}]-Coordinate Operator[link{}]

And last, but most certainly not least, a collection of pieces:
[link{pneumaticcraft:progwidget/conditions}]-Conditions [link{}]

Just drag and drop pieces to make up your program. When you are done writing the program, insert the Drone in the top right of the GUI, and press the 'Export' button. You will notice while hovering over the 'Export' button that you need to craft pieces. For programming to work, you need to either have the pieces in your inventory, or in an inventory next to the Programmer. When you export an already programmed Drone, it will return any pieces that the Drone does not use in the new program.

You can press the 'Import' button to load the program stored in the Drone into the Programmer. This will override any program written in the Programmer.

You can automate the programming of Drones by pressing 'R' while hovering over the 'Export' button. This will put the Programmer in 'program when inserting item' mode. When items are put in via a Hopper for example, the Drone will automatically be tried to be programmed (using the puzzle pieces in an adjacent inventory).

There is a trick to speed up certain programming: Middle-click a puzzle piece to copy the piece along with its properties (so a copied 'area' piece will contain the area of the copied piece). Additionally, when you sneak + middle-click a piece, it will copy an entire branch.

[prefix{l}]Sharing programs[prefix{}]
You can share programs with other worlds/players by clicking on the 'Import/Export layout from/to Pastebin' button. It will open a window in which you can create a pastebin link, or input a pastebin link to import a program. Optionally you can log into your Pastebin account to overcome the limitations you have when not logged in.

[prefix{l}]Convert the program to use relative coordinates[prefix{}]
This concerns an advanced feature to share programs. Say you have designed a program that automatically creates and manages a farm and you want to share this. People on a different world will want to have their farm on a different location, so the user would have to change every [link{pneumaticcraft:progwidget/area}]Area piece[link{}]. The 'Convert to Relative coordinates' button makes this easier. It requires you to set one fixed coordinate (say the position of an input chest). It will then create offsets based on that which are used in the program. The end user will only have to adjust that base coordinate to the one used in their world.