Advertisement
jvanmelckebeke

computercraft - list quarry

Aug 16th, 2021 (edited)
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.68 KB | None | 0 0
  1. --[[
  2.     remember to change monitor and chest (just change left/right)
  3. --]]
  4.  
  5. chest = peripheral.wrap('right')
  6. monitor = peripheral.wrap('left')
  7.  
  8.  
  9. lastTime = os.time()
  10. lastItem = "nothing"
  11. function clear_monitor()
  12.     monitor.clear()
  13. end
  14.  
  15. function send_monitor(line, text)
  16.     monitor.setCursorPos(1, line)
  17.     monitor.write(text)
  18. end
  19.  
  20. while true do
  21.     itemInFirstSlot = chest.getStackInSlot(1)
  22.     if itemInFirstSlot ~= nil then
  23.         lastTime = os.time()
  24.         lastItem = itemInFirstSlot.name
  25.     end
  26.     lastUpdate = os.time() - lastTime
  27.     clear_monitor()
  28.     send_monitor(1, itemInFirstSlot.name)
  29.     send_monitor(2, lastUpdate .. "s ago")
  30.     sleep(1)
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement