nSun

CC AutoDropper

Aug 27th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. local inputSide = "back"
  2. local outputSide = "left"
  3.  
  4. local function output(line,str)
  5.     term.setCursorPos(1,line)
  6.     term.clearLine()
  7.     term.write(str)
  8. end
  9.  
  10. local function hasItem()
  11.   return rs.getInput(inputSide)
  12. end
  13.  
  14. local _blink = true
  15. local function blink()
  16.   rs.setOutput(outputSide,_blink)
  17.   _blink = not _blink
  18. end
  19.  
  20. output(string.format(1,"#%d - %s",
  21.     os.getComputerID(),
  22.     os.getComputerLabel))
  23. sleep(1)
  24.  
  25. while true do
  26.   rs.setOutput(outputSide,false)
  27.   if hasItem() then os.queueEvent("redstone") end
  28.   os.pullEvent("redstone")
  29.  
  30.   while hasItem() do
  31.     blink()
  32.     output(2, hasItem() and "Has item" or "No item")
  33.     sleep(.1)
  34.   end
  35.   sleep(.2)
  36. end
Advertisement
Add Comment
Please, Sign In to add comment