Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Input Variabls for length and width of platform
- local inVars = {...}
- local width = tonumber(inVars[1])
- local length = tonumber(inVars[2])
- local widthCount = tonumber(0)
- -- place a block below turtle till length is reached
- function buildForward()
- for i=1, length do
- checkInv()
- turtle.placeDown()
- turtle.forward()
- end
- end
- -- reorient turtle to the right
- function spinRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turtle.forward()
- end
- -- reorient turtle to the left
- function spinLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turtle.forward()
- end
- function checkInv()
- if turtle.getItemCount( turtle.getSelectedSlot()) == 0 then
- turtle.select(turtle.getSelectedSlot() + 1)
- elseif turtle.getSelectedSlot() == 16 then
- os.shutdown()
- end
- end
- --Main program loop
- while true do
- buildForward()
- spinRight()
- widthCount = widthCount + 1
- if widthCount == width then
- break
- end
- buildForward()
- spinLeft()
- widthCount = widthCount + 1
- if widthCount == width then
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement