This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Railalis's profile picture

Inventory/Sorting program

Started by Railalis, 05 December 2012 - 08:58 AM
Railalis #1
Posted 05 December 2012 - 09:58 AM
This was my first lua program. I hope I could get some suggestions and maybe edits to make it better.
(This is many hours of work so only constructive criticism if you find a problem please.)

The idea is there are two computers, one that makes orders and one that pulls items. The order chest would be put next to the input chest, which uses a normal sorting system to put all the items in the correct chests where the pull computer will keep track of the items in the chest and send them back to the input chest if asked.

Block Layout (From birds eye view):
|H|X|P|X|H|
|T|C|D|C|T|

H = chest
X = transposer
P = pipe
T = item detector
C = computer
D = disk reader

This setup allows for the maximum space conservation. You would stack 8 of these layers (8 layers for 2 sorting machines) with a block in between each layer except on the computers where the wireless modems will sit on top of the computers. There needs to be a disk in the disk readers or no disk reader at all otherwise items will go into it when getting pulled. Also, the pull code needs to be edited for the correct side to receive a pulse from the detector. Each computer also needs to be labeled with the correct lower case item name for the items in the chest.

When an item gets sorted the item detector pulses increasing the inventory variable. When the order is made, the computer pulses the transposer and pulls the item out of the chest and sends it along the line.

Some problems I have encountered are simultaneous events (when items are getting counted and a message comes through), Chest overflow (I plan to update it so that it knows when a chest is full and sends a message), and distance between the order computer and the pull computers.

If you want to use this system please leave credit where it is due.

Let me know what you think. I will respond to questions and comments.

Pictures:
Spoiler



skerbilman #2
Posted 10 December 2012 - 12:14 PM
Looks great. I'm new to ComputerCraft, but I plan on trying a similar system out with a possible screen display listing the current inventory levels for each item based off the counters.
Railalis #3
Posted 10 December 2012 - 12:23 PM
Yea, I recommend putting the order computer in the middle of the sorting complex so it stays within 64 blocks. It is probably best to use a teleporter to get in and out. That or daisy chain computers for the range ^^' which would take more programming.
skerbilman #4
Posted 10 December 2012 - 01:10 PM
Sounds good. I'll probably have to daisy chain. Shouldn't be too bad, but I anticipate the facility to be rather large.