Guest User

auto

a guest
Mar 30th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. function clearAll()
  2.   monitor.clear()
  3.   monitor.setCursorPos(2,2)
  4.   term.clear()
  5.   term.setCursorPos(1,1)
  6. end
  7.  
  8. function farmCollect()
  9.   clearAll()
  10.   check = turtle.detect()
  11.   print("Farm Collection: In Progress")
  12.   if check == true then
  13.     turtle.dig()
  14.     print("Collected!")
  15.     monitor.write("ON!")
  16.     turtle.dropDown()
  17.     os.sleep(2)
  18.     check = false
  19.     clearAll()
  20.   else
  21.     print("Looking for harvest...")
  22.     monitor.write("ON")
  23.     os.sleep(2)
  24.     clearAll()
  25.   end
  26. end
  27.  
  28. function stopSignal()
  29.   x,y = rednet.receive()
  30.   while true do
  31.     if y == "stop" then
  32.       a=a+1
  33.       return
  34.     end
  35.   end
  36. end
  37.  
  38. --The process:
  39.  
  40. a = 0
  41. repeat
  42.   parallel.waitForAny(farmCollect, stopSignal)
  43. until a == 1
  44. textutils.slowPrint("Shutting down...", 10)
  45. os.sleep(3)
  46. os.reboot()
Advertisement
Add Comment
Please, Sign In to add comment