Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local com = require("component")
- local inv_c = com.inventory_controller
- local craft = com.crafting.craft
- local robot = com.robot
- local term = require("term")
- --local rSlots = {1, 2, 3, 5, 6, 7, 9, 10, 11}
- local side = 3
- local outSide = 0
- local function getCoin()
- term.clear()
- print("Search coin..")
- local slots = inv_c.getInventorySize(side)
- if slots ~= nil then
- while true do
- for slotN = 1, slots do
- local slot = inv_c.getStackInSlot(side, slotN)
- if slot ~= nil and string.find(slot.name, "Currency:") ~= nil then
- term.clear()
- print("Getting coin..")
- robot.select(1)
- inv_c.suckFromSlot(side, slotN)
- return
- end
- end
- end
- end
- end
- local stop = false
- local function clearAll()
- term.clear()
- print("Clearing...")
- for i = 1, 16 do
- local s = inv_c.getStackInInternalSlot(n)
- if s ~= nil then
- if s.name == "Currency:Penny" then
- robot.select(n)
- robot.drop(outSide)
- else
- robot.select(n)
- robot.drop(side)
- end
- end
- end
- end
- robot.select(1)
- clearAll()
- while not stop do
- while robot.count(1) > 0 do
- term.clear()
- print("Crafting...")
- robot.select(13)
- craft(240)
- for i = 13, 16 do
- local slot = inv_c.getStackInInternalSlot(i)
- if slot ~= nil then
- if slot.name == "Currency:Penny" then
- robot.select(i)
- robot.drop(outSide)
- else
- robot.select(i)
- robot.drop(side)
- end
- end
- end
- end
- getCoin()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement