Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Move functions
- version 0.2
- --]]
- function shiftLeft(len)
- turtle.turnLeft()
- for i = 1,len do
- turtle.forward()dbs l
- end
- turtle.turnRight()
- end
- function shiftRight(len)
- turtle.turnRight()
- for i = 1,len do
- turtle.forward()
- end
- turtle.turnLeft()
- end
- -- main
- local args = { ... }
- if #args < 1 then
- return
- end
- local command = args[1]
- local len = 1
- if #args >= 2 then
- len = tonumber(args[2])
- end
- fnMove = nil
- if command == "u" then
- fnMove = turtle.up
- elseif command == "d" then
- fnMove = turtle.down
- elseif command == "b" then
- fnMove = turtle.back
- elseif command == "f" then
- fnMove = turtle.forward
- elseif command == "r" then
- fnMove = turtle.turnRight
- elseif command == "l" then
- fnMove = turtle.turnLeft
- elseif command == "sl" then
- -- shift left
- shiftLeft(len)
- return
- elseif command == "sr" then
- -- shift right
- shiftRight(len)
- return
- end
- if fnMove ~= nil then
- for i = 1,len do
- while not fnMove() do
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement