ravneravn

mine controller

Nov 12th, 2013
61
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. w, h = term.getSize()
  2. term.setCursorPos(10, (h/2)-6)
  3. rednet.open("right")
  4. dl = {}
  5.  
  6.  
  7. while true do
  8. term.clear()
  9. term.setCursorPos((w/2)-13,(h/2)-6)
  10. print("Press corresponding number")
  11. print(" ")
  12. print("1. New mine")
  13. print("2. Run download on turtles")
  14. print("3. Download pastebin")
  15. print("4. Send turtles to layer")
  16.  
  17. event, key = os.pullEvent("key")
  18.  
  19. if key == 2 then
  20. rednet.broadcast("new")
  21. elseif key == 3 then
  22. rednet.broadcast("download")
  23. elseif key == 4 then
  24. rednet.broadcast("pastebin")
  25. term.clear()
  26. term.setCursorPos((w/2)-19,(h/2))
  27. print("Enter pastebin code")
  28. term.setCursorPos((w/2)-2, (h/2)+1)
  29. code = io.read()
  30. term.clear()
  31. term.setCursorPos((w/2)-19,(h/2))
  32. print("Enter name for file")
  33. term.setCursorPos((w/2)-2, (h/2)+1)
  34. name = io.read()
  35. dl["placement"] = name
  36. dl["fileName"] = code
  37. pastebin = textutil.serialize(dl)
  38. rednet.broadcast(pastebin)
  39. elseif key == 5 then
  40. rednet.broadcast("go up")
  41. term.clear()
  42. term.setCursorPos((w/2)-17,(h/2))
  43. print("Enter Y level to go to")
  44. level = io.read()
  45. rednet.broadcast(level)
  46. end
  47.  
  48. term.clear()
  49. term.setCursorPos((w/2)-9, (h/2))
  50. print("Sending command")
  51. sleep(2)
  52.  
  53. end
RAW Paste Data