Search the Community
Showing results for tags 'early-game'.
Found 1 result
"FullChest" item sorting storage system This program uses a robot to sort items into simple storage system. I am using iron chests mod here. There is an input chest (golden), storage chests (iron), and an overflow chest (diamond). The robot is placed behind the input chest facing the chest and I recommend placing a charger next to it. Red blocks are always required, orange and yellow blocks are required depending on storage size (in this one, orange blocks are needed). I usually place them all to be sure. The storage chests must always be on the right from the input chest. Each storage chest must have no empty slot! If you want a chest to contain certain items, put one of these items into a slot like this: The robot then goes around in zig-zag pattern and tries to put each item into each chest. All chests have no empty slots, therefore only wanted items can be put into each chest - for all other items the chest is full. If the robot is waiting on the start, it checks the input chest for new items every 10 seconds. If an item is found it will start sorting in 1 minute (except for the first check - then it si immidiet). Program also in attachments robot = require("robot") os = require("os") computer = require("computer") totalSlots = robot.inventorySize() function dropAll(slots) for i = 1, slots, 1 do robot.select(i) robot.drop() end robot.select(1) end function suckAll() count = 0 while robot.suck() do count = count + 1 end return count end -- direction false - left -- direction true - right function next(direction) if not direction then robot.turnLeft() else robot.turnRight() end b = robot.forward() if not direction then robot.turnRight() else robot.turnLeft() end return b end while true do first = true while robot.suck() == false do print("check") first = false os.sleep(10) end robot.drop() print("Sorting is starting...") if not first then print("in 60 seconds...") os.sleep(60) end print("now!") usedSlots = suckAll() if usedSlots > totalSlots then usedSlots = totalSlots end direction = false robot.turnLeft() robot.forward() robot.forward() robot.turnRight() while true do dropAll(usedSlots) while next(direction) do dropAll(usedSlots) end print("end of row") if not robot.up() then -- last row print("end of sorting") robot.turnRight() while robot.forward() do end robot.turnLeft() dropAll(usedSlots) while robot.down() do end dropAll(totalSlots) -- just to be sure break end direction = not direction end end sorter.lua