Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- fPos = tArgs[1]
- yPos = tArgs[2]
- rPos = tArgs[3]
- if fPos == nil or yPos == nil or rPos == nil then
- print("Usage: moveturtle <forward> <up> <right>")
- return -1
- end
- fPos = tonumber(fPos)
- yPos = tonumber(yPos)
- rPos = tonumber(rPos)
- x = 0
- y = 0
- z = 0
- if yPos < 0 then
- yPos = -yPos
- for y = 0, yPos-1, 1 do
- turtle.down()
- end
- elseif yPos > 0 then
- for y = 0, yPos-1, 1 do
- turtle.up()
- end
- end
- if fPos < 0 then
- fPos = -fPos
- turtle.turnRight()
- turtle.turnRight()
- end
- for f = 0, fPos - 1, 1 do
- turtle.forward()
- end
- if rPos < 0 then
- rPos = -rPos
- turtle.turnLeft()
- elseif rPos > 0 then
- turtle.turnRight()
- end
- for r = 0, rPos - 1, 1 do
- turtle.forward()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement