Advertisement
Guest User

zqsd

a guest
Jul 25th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.26 KB | None | 0 0
  1. if turtle then
  2.  
  3. print[[---------------------------------------
  4.  
  5. Welcome to RemoteTurtle V2.0
  6.  
  7. ---------------------------------------]]
  8.  
  9. else
  10.  
  11. if term.isColor() then
  12.  
  13. term.setTextColor(colors.lime)
  14.  
  15. end
  16.  
  17. print[[---------------------------------------------------
  18.  
  19. Welcome to RemoteTurtle V2.0
  20.  
  21. ---------------------------------------------------
  22.  
  23. ]]
  24.  
  25. end
  26.  
  27. if term.isColor() then
  28.  
  29. term.setTextColor(colors.white)
  30.  
  31. end
  32.  
  33. repeat
  34.  
  35.   print("Does the program already exist on your device")
  36.  
  37.   q=read()
  38.  
  39.   if
  40.  
  41.         q==("yes")
  42.  
  43.   then
  44.  
  45.         sleep(0)
  46.  
  47.   else
  48.  
  49.         if
  50.  
  51.           q==("no")
  52.  
  53.         then
  54.  
  55.           os.setComputerLabel("not yet defined")
  56.  
  57.           fs.copy("disk/startup","startup")
  58.  
  59.           print("You can now safely break the device and place it somewhere else without program loss")
  60.  
  61.  
  62.  
  63.           error()  
  64.  
  65.          end
  66.  
  67.   end
  68.  
  69. until q==("yes") or q==("no")
  70.  
  71.  
  72.  
  73. print("")
  74.  
  75. repeat
  76.  
  77.   print("Do you want this device to transmit or receive?")
  78.  
  79.   p=read()
  80.  
  81.   if
  82.  
  83.         p==("receive")
  84.  
  85.   then
  86.  
  87.  
  88.  
  89. os.setComputerLabel("Remote Turtle")
  90.  
  91. print("")
  92.  
  93. shell.run("id")
  94.  
  95. rednet.open("right")
  96.  
  97. print("")
  98.  
  99. print("What Id Do You Want To Link To?")
  100.  
  101. l=tonumber(read())
  102.  
  103. repeat
  104.  
  105. i,k=rednet.receive()
  106.  
  107. z=turtle.getFuelLevel()
  108.  
  109. if
  110.  
  111.   z==0 then
  112.  
  113.   shell.run("refuel")
  114.  
  115. end
  116.  
  117. z=turtle.getFuelLevel()
  118.  
  119. if
  120.  
  121.   z==0 then
  122.  
  123.   rednet.send(l,"p2")
  124.  
  125. end
  126.  
  127. if
  128.  
  129.   l==i and k==("w") then
  130.  
  131.   turtle.forward()
  132.  
  133. elseif
  134.  
  135.   l==i and k==("a") then
  136.  
  137.   turtle.turnLeft()
  138.  
  139.   turtle.forward()
  140.  
  141. elseif
  142.  
  143.   l==i and k==("s") then
  144.  
  145.   turtle.turnRight()
  146.  
  147.   turtle.turnRight()
  148.  
  149.   turtle.forward()
  150.  
  151. elseif
  152.  
  153.   l==i and k==("d") then
  154.  
  155.   turtle.turnRight()
  156.  
  157.   turtle.forward()
  158.  
  159. elseif
  160.  
  161.   l==i and k==("q") then
  162.  
  163.   turtle.up()
  164.  
  165. elseif
  166.  
  167.   l==i and k==("z") then
  168.  
  169.   turtle.down()
  170.  
  171. elseif
  172.  
  173.   l==i and k==("r") then
  174.  
  175.   shell.run("refuel")
  176.  
  177. elseif
  178.  
  179.   l==i and k==("x") then
  180.  
  181.   turtle.dig()
  182.  
  183. elseif
  184.  
  185.   l==i and k==("xup") then
  186.  
  187.   turtle.digUp()
  188.  
  189. elseif
  190.  
  191.   l==i and k==("xdown") then
  192.  
  193.   turtle.digDown()
  194.  
  195. elseif
  196.  
  197.   l==i and k==("turnleft") then
  198.  
  199.   turtle.turnLeft()
  200.  
  201. elseif
  202.  
  203.   l==i and k==("turnright") then
  204.  
  205.   turtle.turnRight()
  206.  
  207. elseif
  208.  
  209.   l==i and k==("clear") then
  210.  
  211.   os.setComputerLabel("")
  212.  
  213. elseif
  214.  
  215.   l==i and k==("f") then
  216.  
  217.   turtle.attack()
  218.  
  219. elseif
  220.  
  221.   l==i and k==("fup") then
  222.  
  223.   turtle.attackUp()
  224.  
  225. elseif
  226.  
  227.   l==i and k==("fdown") then
  228.  
  229.   turtle.attackDown()
  230.  
  231. elseif
  232.  
  233.   l==i and k==("reboot") then
  234.  
  235.   os.reboot()
  236.  
  237. elseif
  238.  
  239.   l==i and k==("shutdown") then
  240.  
  241.   os.shutdown()
  242.  
  243. elseif
  244.  
  245.   l==i and k==(cmd1) then
  246.  
  247.   turtle[cmd1e]()
  248.  
  249. elseif
  250.  
  251.   l==i and k==(cmd2) then
  252.  
  253.   turtle[cmd2e]()
  254.  
  255. elseif
  256.  
  257.   l==i and k==(cmd3) then
  258.  
  259.   turtle[cmd3e]()
  260.  
  261. elseif
  262.  
  263.  
  264.  
  265.   l==i and k==("AddCommand") then
  266.  
  267.   print("Which command do you want to change? 1/2/3")
  268.  
  269.   cwhat=read()
  270.  
  271.   print("for the question :What do you want to execute? you answer has to be what would fill in the blank spot: turtle.[BLANK SPOT]()")
  272.  
  273.  
  274.  
  275.   if cwhat == ("1") then
  276.  
  277.         print("What do you want to type to to execute")
  278.  
  279.  
  280.  
  281.         cmd1=read()  
  282.  
  283.         print("What do you want to execute?")
  284.  
  285.         cmd1e=read()
  286.  
  287.   elseif
  288.  
  289.         chwat == ("2") then
  290.  
  291.         print("What do you want to type to execute?")
  292.  
  293.         cmd2=read()
  294.  
  295.         print("What do you want to execute?")
  296.  
  297.         cmd2e=read()
  298.  
  299.   elseif
  300.  
  301.         chwat == ("3") then
  302.  
  303.         print("What do you want to type to execute?")
  304.  
  305.         cmd3=read()
  306.  
  307.         print("What do you want to execute?")
  308.  
  309.         cmd3e=read()
  310.  
  311.   end
  312.  
  313.  
  314.  
  315.  
  316.  
  317. else
  318.  
  319.   sleep(0.2)
  320.  
  321.   print("Doesn't match")
  322.  
  323.   rednet.send(l,"p")
  324.  
  325. end
  326.  
  327. sleep(0.2)
  328.  
  329. rednet.send(l,"Matches")
  330.  
  331.  
  332.  
  333. until
  334.  
  335. l==i and k==("stop") or l==i and k==("clear")
  336.  
  337. elseif
  338.  
  339.         p==("transmit")
  340.  
  341.   then
  342.  
  343.         os.setComputerLabel("Remote Controller")
  344.  
  345.         print("")
  346.  
  347.         shell.run("id")
  348.  
  349.         print("")
  350.  
  351.  
  352.  
  353.  
  354.  
  355.           if
  356.  
  357.                 peripheral.getType("right") == "modem" then
  358.  
  359.                 rednet.open("right")
  360.  
  361.           elseif
  362.  
  363.                 peripheral.getType("left") == "modem" then
  364.  
  365.                 rednet.open("left")
  366.  
  367.           elseif
  368.  
  369.                 peripheral.getType("top") == "modem" then
  370.  
  371.                 rednet.open("top")
  372.  
  373.           elseif
  374.  
  375.                 peripheral.getType("bottom") == "modem" then
  376.  
  377.                 rednet.open("bottom")
  378.  
  379.           elseif
  380.  
  381.                 peripheral.getType("back") == "modem" then
  382.  
  383.                 rednet.open("back")
  384.  
  385.           elseif
  386.  
  387.                 peripheral.getType("front") == "modem" then
  388.  
  389.                 rednet.open("front")
  390.  
  391.           end
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.         print("")
  400.  
  401.  
  402.  
  403.         print("What id would you like to connect to?")
  404.  
  405.         l=tonumber(read())
  406.  
  407.  
  408.  
  409.         print("")
  410.  
  411.         print("Type /list for a list of commands")
  412.  
  413.         print("")
  414.  
  415.  
  416.  
  417.         repeat
  418.  
  419.           write("Command : ")
  420.  
  421.           x=read()
  422.  
  423.           if
  424.  
  425.                 x==("/list")
  426.  
  427.           then
  428.  
  429.                 print("r --> refuel (This should be done automaticly)")
  430.  
  431.                 print("w/a/s/d --> movement")
  432.  
  433.                 print("q/z --> up/down")
  434.  
  435.                 print("x --> dig")
  436.  
  437.                 print("xup --> dig up")
  438.  
  439.                 print("xdown --> dig down")
  440.  
  441.                 print("turnleft/turnright --> turn left/ turn right")
  442.  
  443.                 print("f --> attack")
  444.  
  445.                 print("fup/fdown --> attacks up/down")
  446.  
  447.                 print("shutdown --> Shuts down transmitter and receiver")
  448.  
  449.                 print("reboot --> reboots transmitter and receiver")
  450.  
  451.                 print("stop --> Stops using this program")
  452.  
  453.                 print("clear --> Clear Memory after picking up")
  454.  
  455.                 print("AddCommand --> Allows you to add commands")
  456.  
  457.  
  458.  
  459.           elseif
  460.  
  461.                 x==("AddCommand") then
  462.  
  463.                 print("To set this up you have to go to your turtle")
  464.  
  465.                 rednet.send(l,x)
  466.  
  467.           else
  468.  
  469.                 rednet.send(l,x)
  470.  
  471.                 sleep(0.00000001)
  472.  
  473.                 y,u=rednet.receive(3)
  474.  
  475.                 if u==("p2") and y==l then
  476.  
  477.                   if term.isColor() then
  478.  
  479.                         term.setTextColor(colors.red)
  480.  
  481.                   end
  482.  
  483.                   print("Out of coal and fuel")
  484.  
  485.                   if term.setTextColor then
  486.  
  487.                         term.setTextColor(colors.white)
  488.  
  489.                   end                  
  490.  
  491.                 end
  492.  
  493.                 if u==("p") and y==l then
  494.  
  495.                   if term.isColor() then
  496.  
  497.                         term.setTextColor(colors.red)
  498.  
  499.                   end
  500.  
  501.                   print("Incorrect Comand")
  502.  
  503.                   if term.isColor() then
  504.  
  505.                         term.setTextColor(colors.white)
  506.  
  507.                   end
  508.  
  509.  
  510.  
  511.                 elseif u==("Matches") and y==l then
  512.  
  513.                   if term.isColor() then
  514.  
  515.                         term.setTextColor(colors.green)
  516.  
  517.                   end
  518.  
  519.                 end
  520.  
  521.                   print("Command Correct")
  522.  
  523.                   if term.isColor() then
  524.  
  525.                         term.setTextColor(colors.white)
  526.  
  527.                   end
  528.  
  529.                 end
  530.  
  531.  
  532.  
  533.         until
  534.  
  535.           x==("clear") or x==("stop")
  536.  
  537.         end
  538.  
  539.  
  540.  
  541.         if
  542.  
  543.           x==("clear")
  544.  
  545.         then
  546.  
  547.           os.setComputerLabel("")
  548.  
  549.         end
  550.  
  551.  
  552.  
  553.   until
  554.  
  555. p==("receive") or p==("transmit")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement