Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("right") --Open rednet, make clearing the screen a single function
- function clear() term.clear() term.setCursorPos(1, 1) end
- while true do
- clear()
- print("Connected, ID: ", os.computerID(), ". Listening for turtles")
- id, msg = rednet.receive() --Wait for a turtle to say it is "Listening"
- if msg == "Listening" then
- rednet.send(id, "goto") --When a waiting turtle is found send the command (goto) to its ID so it can ready for the transmision of coordinates
- clear()
- print("Turtle found, enter goto coordinates")
- print("Enter X")
- local gox = tonumber(io.read()) --Get the coordinates from the player, they could be aquired by another means if needed
- clear()
- print("Enter Y")
- local goy = tonumber(io.read())
- clear()
- print("Enter Z")
- local goz = tonumber(io.read())
- clear()
- print("Coordinates are: ")
- print("X: ",x)
- print("Y: ",y)
- print("Z: ",z)
- print("Sending coordinates")
- rednet.send(id, tostring(gox)) --Convert the coordinates to strings (as rednet only sends strings) and send them to the waiting turtle
- sleep(0.5)
- rednet.send(id, tostring(goy))
- sleep(0.5)
- rednet.send(id, tostring(goz))
- end
- end
Add Comment
Please, Sign In to add comment