Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- turtleID = 111
- up = " "
- front = " "
- down = " "
- actions = {}
- start = 1
- while true do
- term.clear()
- for i = 1, #actions do
- print(actions[i])
- end
- term.setCursorPos(1,1)
- term.clearLine()
- print("Turtle mission control")
- term.setCursorPos(1,2)
- term.clearLine()
- print(" ")
- term.setCursorPos(1,3)
- term.clearLine()
- print(up)
- term.setCursorPos(1,4)
- term.clearLine()
- print(front)
- term.setCursorPos(1,5)
- term.clearLine()
- print(down)
- term.setCursorPos(1,6)
- term.clearLine()
- print(" ")
- while true do
- event, key = os.pullEvent("key")
- if key == keys.w then
- action = "forward"
- redent.send(turtleID, "r = turtle.forward()")
- break
- elseif key == keys.a then
- action = "left"
- redent.send(turtleID, "r = turtle.turnLeft()")
- break
- elseif key == keys.s then
- action = "back"
- redent.send(turtleID, "r = turtle.back()")
- break
- elseif key == keys.d then
- action = "right"
- redent.send(turtleID, "r = turtle.turnRight()")
- break
- elseif key == 42 then
- action = "down"
- redent.send(turtleID, "r = turtle.down()")
- break
- elseif key == 57 then
- action = "up"
- redent.send(turtleID, "r = turtle.up()")
- break
- elseif key == 28 then
- action = "dig"
- redent.send(turtleID, "r = turtle.dig()")
- break
- end
- end
- startClock = os.clock()
- success = false
- while os.clock - startClock < 3 do
- id, msg = rednet.receive(1)
- if id == turtleID then
- success = true
- break
- end
- end
- if not success then error("Connection lost!") end
- r, front, up, down = textutils.unserialize(msg)
- if r then
- table.insert(actions, acac)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement