Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Spacial Controls:")
- print("W/S = Forward/Back")
- print("A/D = Turn Left/Right")
- print("Space/Shift = Move Up/Down")
- print("Other Commands:")
- print("ESC = Exit Program/Exit Turtle Interface")
- print("R = Refuel from any slot")
- commands = {[17] = forward, [31] = back, [30] = lt, [32] = rt, [57] = up, [42] = down, [19] = refuel, [1] = terminate}
- function forward()
- turtle.forward()
- end
- function back()
- turtle.back()
- end
- function lt()
- turtle.turnLeft()
- end
- function rt()
- turtle.turnRight()
- end
- function up()
- turtle.up()
- end
- function down()
- turtle.down()
- end
- function refuel()
- for i = 1, 16 do
- turtle.select(i)
- turtle.refuel(64)
- end
- end
- function terminate()
- os.reboot()
- end
- while true do
- event, button = os.pullEvent("key")
- fn = commands[button]
- if fn ~= nil then
- fn()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement