MatthewGB

RC Turtle Master

Apr 29th, 2014
239
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. os.pullEvent = os.pullEventRaw
  2. shell.run("label set RCTurtleMaster")
  3. print("You need to shift right click the top of the computer with a wireless modem!")
  4. rednet.open("top")
  5. term.clear()
  6. print("Remote Control Turtle Master")
  7. print("Type ? for possible commands")
  8. while 1<2 do
  9.  write("Cmd: ")
  10.  a = read()
  11.  if a == "?" then
  12.   term.clear()
  13.   term.setCursorPos(1,1)
  14.   print("? - get commands")
  15.   read()
  16.   print("dig - dig the block in front of the turtle")
  17.   read()
  18.   print("forward[number] -  move the turtle [number] blocks forward, destroying blocks if they are in the path")
  19.   read()
  20.   print("up[number] -  move the turtle [number] blocks up, destroying blocks if they are in the path")
  21.   read()
  22.   print("down[number] -  move the turtle [number] blocks down, destroying blocks if they are in the path")
  23.   read()
  24.   print("back[number] -  move the turtle [number] blocks backwards")
  25.   read()
  26.   print("drop - drop all items in the selected slot in front, will put in chest/turtle if it is infront")
  27.   read()
  28.   print("dropup - drop all items in the selected slot above, will put in chest/turtle if it is above")
  29.   read()
  30.   print("dropdown - drop all items in the selected slot below, will put in chest/turtle if it is below")
  31.   read()
  32.   print("select[number] - select slot [number]. Only use numbers 1-16, or it may crash all the turtles")
  33.   read()
  34.   print("empty - drop all items in all slots in front, will put in chest/turtle if it is infront")
  35.   read()
  36.   print("emptyup - drop all items in all slots above, will put in chest/turtle if it is above")
  37.   read()
  38.   print("emptydown - drop all items in all slots below, will put in chest/turtle if it is below")
  39.   read()
  40.   print("ud - update this computer and the turtles")
  41.   read()
  42.   print("ping - find out how many turtles are listening to this computer")
  43.   read()
  44.   term.clear()
  45.   term.setCursorPos(1,1)
  46.  elseif a == "ud" then
  47.   rednet.broadcast("ud")  
  48.   print("Will now update...")
  49.   sleep(0.4)
  50.   shell.run("pastebin get HVArpJ7c ud")
  51.   shell.run("ud")
  52.  elseif a == "ping" then
  53.   print("Sending ping...")
  54.   rednet.broadcast("ping")
  55.   print("Awaiting reposes...")
  56.   done = false
  57.   tt = 0
  58.   print("---------------------------------------")
  59.   while done == false do
  60.    p3 = "N/A"
  61.    p1, p2 = rednet.receive(1)
  62.    if p1 == nil then
  63.     done = true
  64.    else
  65.     print("Found turtle! P1: "..p1.." P2: "..p2.." P3: "..p3)
  66.     tt = tt + 1
  67.    end
  68.   end
  69.   print("----------------------------------------")
  70.   print("Total turtles found: "..tt)
  71.  
  72.  else
  73.   rednet.broadcast(a)
  74.  end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment