iTheDroid

startup

Feb 10th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.99 KB | None | 0 0
  1. if turtle then
  2. print[[---------------------------------------
  3. Welcome to RemoteTurtle V2.0
  4. ---------------------------------------]]
  5. else
  6. if term.isColor() then
  7. term.setTextColor(colors.lime)
  8. end
  9. print[[---------------------------------------------------
  10. Welcome to RemoteTurtle V2.0
  11. ---------------------------------------------------
  12. ]]
  13. end
  14. if term.isColor() then
  15. term.setTextColor(colors.white)
  16. end
  17. repeat
  18. print("Does the program already exist on your device")
  19. q=read()
  20. if
  21. q==("yes")
  22. then
  23. sleep(0)
  24. else
  25. if
  26. q==("no")
  27. then
  28. os.setComputerLabel("not yet defined")
  29. fs.copy("disk/startup","startup")
  30. print("You can now safely break the device and place it somewhere else without program loss")
  31.  
  32. error()
  33. end
  34. end
  35. until q==("yes") or q==("no")
  36.  
  37. print("")
  38. repeat
  39. print("Do you want this device to transmit or receive?")
  40. p=read()
  41. if
  42. p==("receive")
  43. then
  44.  
  45. os.setComputerLabel("Remote Turtle")
  46. print("")
  47. shell.run("id")
  48. rednet.open("right")
  49. print("")
  50. print("What Id Do You Want To Link To?")
  51. l=tonumber(read())
  52. repeat
  53. i,k=rednet.receive()
  54. z=turtle.getFuelLevel()
  55. if
  56. z==0 then
  57. shell.run("refuel")
  58. end
  59. z=turtle.getFuelLevel()
  60. if
  61. z==0 then
  62. rednet.send(l,"p2")
  63. end
  64. if
  65. l==i and k==("w") then
  66. turtle.forward()
  67. elseif
  68. l==i and k==("a") then
  69. turtle.turnLeft()
  70. turtle.forward()
  71. elseif
  72. l==i and k==("s") then
  73. turtle.turnRight()
  74. turtle.turnRight()
  75. turtle.forward()
  76. elseif
  77. l==i and k==("d") then
  78. turtle.turnRight()
  79. turtle.forward()
  80. elseif
  81. l==i and k==("q") then
  82. turtle.up()
  83. elseif
  84. l==i and k==("z") then
  85. turtle.down()
  86. elseif
  87. l==i and k==("r") then
  88. shell.run("refuel")
  89. elseif
  90. l==i and k==("x") then
  91. turtle.dig()
  92. elseif
  93. l==i and k==("xup") then
  94. turtle.digUp()
  95. elseif
  96. l==i and k==("xdown") then
  97. turtle.digDown()
  98. elseif
  99. l==i and k==("turnleft") then
  100. turtle.turnLeft()
  101. elseif
  102. l==i and k==("turnright") then
  103. turtle.turnRight()
  104. elseif
  105. l==i and k==("clear") then
  106. os.setComputerLabel("")
  107. elseif
  108. l==i and k==("f") then
  109. turtle.attack()
  110. elseif
  111. l==i and k==("fup") then
  112. turtle.attackUp()
  113. elseif
  114. l==i and k==("fdown") then
  115. turtle.attackDown()
  116. elseif
  117. l==i and k==("reboot") then
  118. os.reboot()
  119. elseif
  120. l==i and k==("shutdown") then
  121. os.shutdown()
  122. elseif
  123. l==i and k==(cmd1) then
  124. turtle[cmd1e]()
  125. elseif
  126. l==i and k==(cmd2) then
  127. turtle[cmd2e]()
  128. elseif
  129. l==i and k==(cmd3) then
  130. turtle[cmd3e]()
  131. elseif
  132.  
  133. l==i and k==("AddCommand") then
  134. print("Which command do you want to change? 1/2/3")
  135. cwhat=read()
  136. 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]()")
  137.  
  138. if cwhat == ("1") then
  139. print("What do you want to type to to execute")
  140.  
  141. cmd1=read()
  142. print("What do you want to execute?")
  143. cmd1e=read()
  144. elseif
  145. chwat == ("2") then
  146. print("What do you want to type to execute?")
  147. cmd2=read()
  148. print("What do you want to execute?")
  149. cmd2e=read()
  150. elseif
  151. chwat == ("3") then
  152. print("What do you want to type to execute?")
  153. cmd3=read()
  154. print("What do you want to execute?")
  155. cmd3e=read()
  156. end
  157.  
  158.  
  159. else
  160. sleep(0.2)
  161. print("Doesn't match")
  162. rednet.send(l,"p")
  163. end
  164. sleep(0.2)
  165. rednet.send(l,"Matches")
  166.  
  167. until
  168. l==i and k==("stop") or l==i and k==("clear")
  169. elseif
  170. p==("transmit")
  171. then
  172. os.setComputerLabel("Remote Controller")
  173. print("")
  174. shell.run("id")
  175. print("")
  176.  
  177.  
  178. if
  179. peripheral.getType("right") == "modem" then
  180. rednet.open("right")
  181. elseif
  182. peripheral.getType("left") == "modem" then
  183. rednet.open("left")
  184. elseif
  185. peripheral.getType("top") == "modem" then
  186. rednet.open("top")
  187. elseif
  188. peripheral.getType("bottom") == "modem" then
  189. rednet.open("bottom")
  190. elseif
  191. peripheral.getType("back") == "modem" then
  192. rednet.open("back")
  193. elseif
  194. peripheral.getType("front") == "modem" then
  195. rednet.open("front")
  196. end
  197.  
  198.  
  199.  
  200. print("")
  201.  
  202. print("What id would you like to connect to?")
  203. l=tonumber(read())
  204.  
  205. print("")
  206. print("Type /list for a list of commands")
  207. print("")
  208.  
  209. repeat
  210. write("Command : ")
  211. x=read()
  212. if
  213. x==("/list")
  214. then
  215. print("r --> refuel (This should be done automaticly)")
  216. print("w/a/s/d --> movement")
  217. print("q/z --> up/down")
  218. print("x --> dig")
  219. print("xup --> dig up")
  220. print("xdown --> dig down")
  221. print("turnleft/turnright --> turn left/ turn right")
  222. print("f --> attack")
  223. print("fup/fdown --> attacks up/down")
  224. print("shutdown --> Shuts down transmitter and receiver")
  225. print("reboot --> reboots transmitter and receiver")
  226. print("stop --> Stops using this program")
  227. print("clear --> Clear Memory after picking up")
  228. print("AddCommand --> Allows you to add commands")
  229.  
  230. elseif
  231. x==("AddCommand") then
  232. print("To set this up you have to go to your turtle")
  233. rednet.send(l,x)
  234. else
  235. rednet.send(l,x)
  236. sleep(0.00000001)
  237. y,u=rednet.receive(3)
  238. if u==("p2") and y==l then
  239. if term.isColor() then
  240. term.setTextColor(colors.red)
  241. end
  242. print("Out of coal and fuel")
  243. if term.setTextColor then
  244. term.setTextColor(colors.white)
  245. end
  246. end
  247. if u==("p") and y==l then
  248. if term.isColor() then
  249. term.setTextColor(colors.red)
  250. end
  251. print("Incorrect Comand")
  252. if term.isColor() then
  253. term.setTextColor(colors.white)
  254. end
  255.  
  256. elseif u==("Matches") and y==l then
  257. if term.isColor() then
  258. term.setTextColor(colors.green)
  259. end
  260. end
  261. print("Command Correct")
  262. if term.isColor() then
  263. term.setTextColor(colors.white)
  264. end
  265. end
  266.  
  267. until
  268. x==("clear") or x==("stop")
  269. end
  270.  
  271. if
  272. x==("clear")
  273. then
  274. os.setComputerLabel("")
  275. end
  276.  
  277. until
  278. p==("receive") or p==("transmit")
Add Comment
Please, Sign In to add comment