-
Notifications
You must be signed in to change notification settings - Fork 1
Generic Auto Processing Program
#Generic Auto Processing Program
The purpose of this program is to be a starting point for stock-level based auto-processing of any kind. The concept behind this is simple. The program has a control inventory that is used for managing what is to be produced and in what quantity. This is done by defining control slots in a control inventory that are scanned for items to be auto-processed based on stock levels.

To get this program, copy the code and use ctrl-v to paste it inside a Programmer.
This program has three distinct sub-programs.

This program is used to bootstrap the actual program, which then runs continuously. On receipt of a redstone signal, it checks to see if the lock is set, then
- if not set, set the lock and send signal 0 (which starts the main program)
- if set, exit.
This can be used to restart the program after a server restart by using a timer, or to manually start it by putting a button on the network node.

On receipt of signal 0, this program loops over slots 0 - 26 in the inventory on top of the network node.
I chose this as it is equivalent to the first three rows of a chest. This leaves the second three rows for crafting cards, useful in defining the actual ingredients required to make the target item.
For each slot, it calculates a stock level for the item in that slot by multiplying the quantity of items in the slot by 64. If there are no items (0), it moves on to the next slot. If there is an item, it then gets the item and checks the stock level in the external storage (by default, a storage scanner module). If there are enough items in the external storage, it moves on to the next slot. If not, it triggers signal 1 to execute the processing program (which actually creates the item in question and puts it back into the external storage). The processing program is expected to trigger signal 2 to resume the loop program.
When all slots have been processed, it pauses for a moment then triggers signal 0 to start the loop again.
The processing program is triggered by signal 2 and must end with triggering signal 1. The processing program included here is simply a debug program that gets the item in the current slot (variable 0) and logs its name, pauses and the triggers the continuation signal.
The Alloy Smelter and Sag Mill programs have examples of working processing programs.
-
as written, this assumes the network node name is
b. -
as written, this requires one RAM chip, a network card and 2 variables to be allocated to the program. You will likely also need to allocate inventory slots to do anything useful with it.
-
as written, this multiples the number of items in each slot by 64 before checking external storage. This means stock keeping in multiples of 64 between 1 and 64 stacks. Change this to a smaller or larger number to suit your needs.
-
as written, this assumes a storage scanner module linked to a storage scanner that has both the items to manage and their ingredients.