Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- osPullEvent = osPullEventRaw
- term.clear()
- term.setCursorPos(1,1)
- correctid = 212
- rednet.open("right")
- rednet.send(correctid, "getturtleID")
- g,TurtleNetID = rednet.receive(5)
- TurtleNetID = TurtleNetID .. " "
- print("Robot Fleet #".. TurtleNetID ..)
- rednet.send(correctid, "New turtle at " .. gps.locate(20, false))
- if TurtleNetID = " " then
- print("Could not get TurtleNet ID, please ctrl+t and try again")
- end
- running = 1
- while running = 1 do
- while running = 1 do
- I,m,d = rednet.receive()
- if I != correctid then
- break
- end
- if m = TurtleNetID .. "location" then
- rednet.send(I, gps.locate(20, false))
- end
- if m = TurtleNetID .. "forward" then
- if turtle.forward() != "true" then
- rednet.send(I, "Error moving forwards")
- end
- end
- if m = TurtleNetID .. "back" then
- if turtle.back() != "true" then
- rednet.send(I, "Error moving backwards")
- end
- end
- if m = TurtleNetID .. "up" then
- if turtle.up() != "true" then
- rednet.send(I, "Error moving up")
- end
- end
- if m = TurtleNetID .. "down" then
- if turtle.down() != "true" then
- rednet.send(I, "Error moving down")
- end
- end
- if m = TurtleNetID .. "turn left" then
- turtle.turnLeft()
- rednet.send(I, "Turned left")
- end
- if m = TurtleNetID .. "turn right" then
- turtle.turnRight()
- rednet.send(I, "Turned right")
- end
- if m = TurtleNetID .. "dig front" then
- turtle.dig()
- rednet.send(I, "Dug front")
- end
- if m = TurtleNetID .. "dig up" then
- turtle.digUp()
- rednet.send(I, "Dug up")
- end
- if m = TurtleNetID .. "dig down" then
- turtle.digDown()
- rednet.send(I, "Dug down")
- end
- if m = TurtleNetID .. "place front" then
- if turtle.place() != "true" then
- rednet.send(I, "Error placing in front")
- end
- end
- if m = TurtleNetID .. "place up" then
- if turtle.placeUp() != "true" then
- rednet.send(I, "Error placing up")
- end
- if m = TurtleNetID .. "place down" then
- if turtle.placeDown() != "true" then
- rednet.send(I, "Error placing up")
- end
- end
- if m = TurtleNetID .. "detect front" then
- if turtle.detect = "true" then
- rednet.send(I, "Block in front")
- end
- end
- if m = TurtleNetID .. "detect up" then
- if turtle.detectUP() != "true" then
- rednet.send(I, "Block up")
- end
- end
- if m = TurtleNetID .. "detect down" then
- if turtle.detectDown() != "true" then
- rednet.send(I, "Block down")
- end
- end
- if m = TurtleNetID .. "spew" then
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- turtle(drop)
- end
- if m = "reset ID" then
- rednet.send(I, TurtleNetID)
- end
- if m = "report in" then
- rednet.send(I, "Turtle ID ".. TurtleNetID .. " reporting in from " gps.locate(20, false))
- end
- if m = TurtleNetID .. "terminate" then
- running = 0
- end
- I,m,d = 0
- end
- end
Add Comment
Please, Sign In to add comment