Advertisement
Erit1566

Untitled

Jun 20th, 2014
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. id = 15 --change to turtle id
  2. n=1
  3. options = {
  4. "Drop Payload",
  5. "Go Up",
  6. "Go Down",
  7. "Go Left",
  8. "Go Right",
  9. "Go Forward",
  10. "Go Backward",
  11. "Dig",
  12. "Turn Left",
  13. "Turn Right",
  14. }
  15. local function opt(m,mY)
  16. l=#m
  17. while true do
  18. for i=1, l, 1 do
  19. if i==n then
  20. local x, y = term.getSize()
  21. local b = string.len(">"..m[i].."<")/2
  22. local x = (x/2)-b
  23. term.setCursorPos(x,i+mY)
  24. term.clearLine()
  25. print(">"..m[i].."<")
  26. else
  27. local x, y = term.getSize()
  28. b = string.len(m[i])/2
  29. x = (x/2)-b
  30. term.setCursorPos(x,i+mY)
  31. term.clearLine()
  32. print(m[i]) end
  33. end
  34. a, b= os.pullEventRaw()
  35. if a == "key" then
  36. if b==200 and n>1 then n=n-1 end
  37. if b==208 and n<l then n=n+1 end
  38. if b==28 then break end
  39. end
  40. end
  41. term.clear() term.setCursorPos(1,1)
  42. return n
  43. end
  44. while true do
  45. term.clear()
  46. rednet.open("side") --Change to the side of your modem
  47. local input = opt(options,0)
  48. if input == 1 then
  49. rednet.send(id,"payload,1")
  50. elseif input == 2 then
  51. rednet.send(id,"up,1")
  52. elseif input == 3 then
  53. rednet.send(id,"down,1")
  54. elseif input == 4 then
  55. rednet.send(id,"left,1")
  56. elseif input == 5 then
  57. rednet.send(id,"right,1")
  58. elseif input == 6 then
  59. rednet.send(id,"forward,1")
  60. elseif input == 7 then
  61. rednet.send(id,"back,1")
  62. elseif input == 8 then
  63. rednet.send(id,"dig,1")
  64. elseif input == 9 then
  65. rednet.send(id,"lLeft,1")
  66. elseif input == 10 then
  67. rednet.send(id,"lRight,1")
  68. end
  69. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement