Advertisement
NanoBob

Remote Turtle v1.6

May 5th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.49 KB | None | 0 0
  1. repeat
  2.   print("Does the program already exist on your device")
  3.   q=read()
  4.   if
  5.     q==("yes")
  6.   then
  7.     sleep(0)
  8.   else
  9.     if
  10.       q==("no")
  11.     then
  12.       os.setComputerLabel("not yet defined")
  13.       fs.copy("disk/startup","startup")
  14.       print("You can now safely brake the device and place it somewhere else")
  15.     end
  16.   end
  17. until q==("yes") or q==("no")
  18.  
  19. repeat
  20.   print("Do you want this device to transmit or receive?")
  21.   p=read()
  22.   if
  23.     p==("receive")
  24.   then
  25.  
  26. os.setComputerLabel("Remote Turtle")
  27. shell.run("id")
  28. rednet.open("right")
  29. print("What Id Do You Want To Link To?")
  30. l=tonumber(read())
  31. repeat
  32. i,k=rednet.receive()
  33. z=turtle.getFuelLevel()
  34. if
  35.   z<=80 then
  36.   shell.run("refuel")
  37. end
  38.  
  39. if
  40.   l==i and k==("w") then
  41.   turtle.forward()
  42. elseif
  43.   l==i and k==("a") then
  44.   turtle.turnLeft()
  45.   turtle.forward()
  46. elseif
  47.   l==i and k==("s") then
  48.   turtle.turnRight()
  49.   turtle.turnRight()
  50.   turtle.forward()
  51. elseif
  52.   l==i and k==("d") then
  53.   turtle.turnRight()
  54.   turtle.forward()
  55. elseif
  56.   l==i and k==("q") then
  57.   turtle.up()
  58. elseif
  59.   l==i and k==("z") then
  60.   turtle.down()
  61. elseif
  62.   l==i and k==("r") then
  63.   shell.run("refuel")
  64. elseif
  65.   l==i and k==("x") then
  66.   turtle.dig()
  67. elseif
  68.   l==i and k==("xup") then
  69.   turtle.digUp()
  70. elseif
  71.   l==i and k==("xdown") then
  72.   turtle.digDown()
  73. elseif
  74.   l==i and k==("turnleft") then
  75.   turtle.turnLeft()
  76. elseif
  77.   l==i and k==("turnright") then
  78.   turtle.turnRight()
  79. elseif
  80.   l==i and k==("clear") then
  81.   os.setComputerLabel("")
  82. elseif
  83.   l==i and k==("f") then
  84.   turtle.attack()
  85. elseif
  86.   l==i and k==("fup") then
  87.   turtle.attackUp()
  88. elseif
  89.   l==i and k==("fdown") then
  90.   turtle.attackDown()
  91. else
  92.   print("Doesn't match")
  93. end
  94.  
  95. until
  96. l==i and k==("stop") or l==i and k==("clear")
  97.  
  98. elseif
  99.     p==("transmit")
  100.   then
  101.     os.setComputerLabel("Remote Controller")
  102.     shell.run("id")
  103.     print("")
  104.    
  105.    
  106.       if
  107.         peripheral.getType("right") == "modem" then
  108.         rednet.open("right")
  109.       elseif
  110.         peripheral.getType("left") == "modem" then
  111.         rednet.open("left")
  112.       elseif
  113.         peripheral.getType("top") == "modem" then
  114.         rednet.open("top")
  115.       elseif
  116.         peripheral.getType("bottom") == "modem" then
  117.         rednet.open("bottom")
  118.       elseif
  119.         peripheral.getType("back") == "modem" then
  120.         rednet.open("back")
  121.       elseif
  122.         peripheral.getType("front") == "modem" then
  123.         rednet.open("front")
  124.       end
  125.        
  126.    
  127.    
  128.     print("")
  129.    
  130.     print("What id would you like to connect to?")
  131.     i=tonumber(read())
  132.    
  133.     print("")
  134.     print("Type /list for a list of commands")
  135.     print("")
  136.    
  137.     repeat
  138.       write("Command : ")
  139.       x=read()
  140.       if
  141.         x==("/list")
  142.       then
  143.         print("r --> refuel (This should be done automaticly)")
  144.         print("w/a/s/d --> movement")
  145.         print("q/z --> up/down")
  146.         print("x --> dig")
  147.         print("xup --> dig up")
  148.         print("xdown --> dig down")
  149.         print("turnleft/turnright --> turn left/ turn right")
  150.         print("f --> attack")
  151.         print("fup/fdown --> attacks up/down")
  152.        
  153.         print("stop --> Stops using this program")
  154.         print("clear --> Clear Memory after picking up")
  155.       else
  156.         rednet.send(i,x)
  157.       end
  158.     until
  159.       x==("clear") or x==("stop")
  160.     end
  161.    
  162.     if
  163.       x==("clear")
  164.     then
  165.       os.setComputerLabel("")
  166.     end
  167.    
  168.   until
  169. p==("receive") or p==("transmit")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement