Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local side = "right"
- local function on()
- rs.setOutput(side, true)
- end
- local function off()
- rs.setOutput(side, false)
- end
- local function check()
- local s = peripheral.call(side, "size")
- local items = peripheral.call(side, "list")
- io.write(".")
- for i = 1, s do
- io.write(".")
- if items[i] then
- io.write(".")
- return true
- end
- end
- io.write(".")
- return false
- end
- local function switch()
- while check() do
- on()
- os.sleep(0.2)
- off()
- os.sleep(0.2)
- end
- end
- while true do
- print()
- io.write("Running check")
- if check() then
- print()
- print("Check passed (items in inventory), emptying.")
- switch()
- print()
- print("Done.")
- else
- print("Check failed (no items in inventory), idling.")
- end
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement