Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- quit = false
- term.clear()
- term.setCursorPos(1, 1)
- textutils.slowPrint("What turtle would you like to connect to?")
- turtle = tonumber(read())
- textutils.slowPrint("Attempting to establish connection")
- for i = 1,5 do
- textutils.slowWrite("...",1.5)
- sleep(.5)
- term.clearLine()
- term.setCursorPos(1, 4)
- end
- rednet.send(turtle,"Ping")
- id, msg, dis = rednet.receive(10)
- if id == nil or msg == nil or dis == nil then
- textutils.slowPrint("Failed to establish connection with turtle: "..turtle)
- sleep(1)
- else
- textutils.slowPrint("Established connection with turtle: "..turtle)
- sleep(1)
- while quit ~= true do
- term.clear()
- term.setCursorPos(1, 1)
- print("Forward: 8")
- print("Back: 2")
- print("Turn Left: 4")
- print("Turn Right: 6")
- print("Up: Arrow Up")
- print("Down: Arrow Down")
- print("TNT: T")
- print("Attack: Space Bar")
- term.setCursorPos(1, 10)
- event, key = os.pullEvent("key")
- if key == 72 then
- rednet.send(turtle,"Forward")
- elseif key == 80 then
- rednet.send(turtle,"Back")
- elseif key == 75 then
- rednet.send(turtle,"Turn Left")
- elseif key == 77 then
- rednet.send(turtle,"Turn Right")
- elseif key == 200 then
- rednet.send(turtle,"Up")
- elseif key == 208 then
- rednet.send(turtle,"Down")
- elseif key == 57 then
- rednet.send(turtle,"Attack")
- elseif key == 20 then
- rednet.send(turtle,"TNT")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment