Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- chestA = peripheral.wrap("back")
- chestB = peripheral.wrap("top")
- dispenserA = peripheral.wrap("left")
- dispenserB = peripheral.wrap("right")
- amountA = 0
- amountB = 0
- amountA = 0
- amountB = 0
- randomA = 0
- randomB = 0
- slotRA = 0
- slotRB = 0
- function amount()
- for j = 1, chestA.getInventorySize() do
- if chestA.getStackInSlot(j) ~= nil then
- --Checks the amount of items in chest A
- amountA = amountA + 1
- end
- end
- print(amountA)
- for k = 1, chestB.getInventorySize() do
- if chestB.getStackInSlot(k) ~= nil then
- --Checks the amount of items in chest B
- amountB = amountB + 1
- end
- end
- print(amountB)
- end
- function numbers()
- randomA = math.random(amountA)
- randomB = math.random(amountB)
- --Random numbers for output for randomizing drop
- end
- function push()
- chestA.pushItemIntoSlot("north",randomA,1,1)
- --should push to chest in between of this one and dispenser
- chestB.pushItemIntoSlot("south",randomB,1,1)
- dispenserA.pullItemIntoSlot("east",1,1,5)
- dispenserB.pullItemIntoSlot("up",1,1,5)
- rs.setOutput("left", true)
- rs.setOutput("right", true)
- sleep(0,5)
- rs.setOutput("left", false)
- rs.setOutput("right", false)
- --dispenses things
- end
- function wait()
- backA = 0
- backB = 0
- while true do
- if backA == 0 then
- for l = 1, 9 do
- if dispenserA.getStackInSlot(l) ~= nil then
- --should wait for when item is reinserted to dispenser
- backA = 1
- slotRA = l
- --logs which slot item had been put into
- end
- end
- end
- if backB == 0 then
- for m = 1, 9 do
- if dispenserB.getStackInSlot(m) ~=nil then
- --should wait for when item is reinserted to dispenser
- backB = 1
- slotRB = m
- --logs which slot item had been put into
- end
- end
- end
- if backA == 1 and backB == 1 then
- --if both are back it breaks the loop
- break
- end
- end
- end
- function back()
- dispenserA.pushItemIntoSlot("east",slotRA,1,1)
- --takes from dispenser from slot that has been logged, inot chest inbetween
- dispenserB.pushItemIntoSlot("up",slotRB,1,1)
- chestA.pullItemIntoSlot("north", 1, 1, randomA)
- chestB.pullItemIntoSlot("south", 1, 1, randomB)
- end
- amount()
- numbers()
- push()
- wait()
- back()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement