Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modemside = "right" -- Side the modem is
- local send = 1 -- Sending to ID
- rednet.open(modemside)
- function forward()
- term.setCursorPos(12,10)
- print("^")
- end
- function back()
- term.setCursorPos(12,10)
- print("V")
- end
- function left()
- term.setCursorPos(12,10)
- print("<")
- end
- function right()
- term.setCursorPos(12,10)
- print(">")
- end
- function error(code)
- term.setCursorPos(8,11)
- print(code)
- end
- term.clear()
- term.setCursorPos(1,1)
- print("LINUX TURTLE API")
- print("Arrow keys to move this")
- print("[ = Break block up, ] build block up")
- print("t = build block down")
- print("W, A, S, D = Move")
- print("O = turn right, P = turn left")
- print("L = place block, K = break block")
- print("1 - 9 (Numpad too) Select block")
- print("Q = dig down")
- print("E = Dig down + move donw")
- print("+ / - = up / down")
- print("BACKSPACE = Drop items")
- print("~ = Change status to mining status*")
- print("TAB to stop, Lshift to restart the turtle")
- print("* = Cant be undone! Need reset by player")
- print("")
- print("Direction: ")
- print("Error:")
- stop = false
- while not stop do
- event, char = os.pullEvent()
- if turtle then
- if event == "key" and char == 200 then
- turtle.forward()
- end
- if event == "key" and char == 203 then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnRight()
- end
- if event == "key" and char == 208 then
- turtle.back()
- end
- if event == "key" and char == 205 then
- turtle.turnRight()
- turtle.forward()
- turtle.turnLeft()
- end
- if event == "key" and char == 201 then
- turtle.up()
- end
- if event == "key" and char == 209 then
- turtle.down()
- end
- end
- if event == "key" and char == 14 then
- rednet.send(send, "drop")
- end
- if event == "key" and char == 41 then
- rednet.send(send, "mine")
- end
- if event == "key" and char == 42 then
- rednet.send(send, "restart")
- end
- if event == "key" and char == 27 then
- rednet.send(send, "buildup")
- end
- if event == "key" and char == 20 then
- rednet.send(send, "builddown")
- end
- if event == "key" and char == 26 then
- rednet.send(send, "breakblockup")
- end
- if event == "key" and char == 37 then
- rednet.send(send, "dig")
- end
- if event == "key" and char == 25 then
- rednet.send(send, "turnleft")
- end
- if event == "key" and char == 24 then
- rednet.send(send, "turnright")
- end
- if event == "key" and char == 38 then
- rednet.send(send, "place")
- end
- if event == "key" and char == 2 or event == "key" and char == 199 then
- rednet.send(send, "1")
- end
- if event == "key" and char == 3 or event == "key" and char == 200 then
- rednet.send(send, "2")
- end
- if event == "key" and char == 4 or event == "key" and char == 201 then
- rednet.send(send, "3")
- end
- if event == "key" and char == 5 or event == "key" and char == 203 then
- rednet.send(send, "4")
- end
- if event == "key" and char == 6 or event == "key" and char == 0 then
- rednet.send(send, "5")
- end
- if event == "key" and char == 7 or event == "key" and char == 205 then
- rednet.send(send, "6")
- end
- if event == "key" and char == 8 or event == "key" and char == 207 then
- rednet.send(send, "7")
- end
- if event == "key" and char == 9 or event == "key" and char == 208 then
- rednet.send(send, "8")
- end
- if event == "key" and char == 10 or event == "key" and char == 209 then
- rednet.send(send, "9")
- end
- if event == "key" and char == 18 then
- rednet.send(send, "digdowndown")
- end
- if event == "key" and char == 16 then
- rednet.send(send, "digdown")
- end
- if event == "key" and char == 54 and char == 13 or event == "key" and char == 13 then
- rednet.send(send, "up")
- end
- if event == "key" and char == 54 and char == 12 or event == "key" and char == 12 then
- rednet.send(send, "down")
- end
- if event == "key" and char == 17 then
- rednet.send(send, "forward")
- end
- if event == "key" and char == 30 then
- rednet.send(send, "left")
- end
- if event == "key" and char == 31 then
- rednet.send(send, "back")
- end
- if event == "key" and char == 32 then
- rednet.send(send, "right")
- end
- if event == "key" and char == 15 then
- term.clear()
- term.setCursorPos(1,1)
- print("Thanks for using Linux Wireless Moving API")
- stop = true
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement