Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local tArgs = {...}
- if #tArgs == 0 then
- print("Please input a length")
- length = 0
- rows = 0
- elseif (tonumber(tArgs[1]% == 0) then
- print("Please enter an even number (bot has to return)")
- length = 0
- rows = 0
- elseif #tArgs == 1 then
- length = (tonumber(tArgs[1]) - 2)
- rows = 0
- else
- length = (tonumber(tArgs[1]) - 2)
- rows = tonumber(tArgs[2])
- end
- turtle.select(1)
- itemCount = turtle.getItemCount(1)
- function PlaceAndCheck()
- if (itemCount == 0) then
- Restock()
- end
- turtle.place()
- itemCount = itemCount - 1
- end
- function Restock()
- if (turtle.getItemCount(turtle.getSelectedSlot()) == 0) then
- if (turtle.getSelectedSlot() == 16) then
- return
- else
- turtle.select(turtle.getSelectedSlot() + 1)
- itemCount = turtle.getItemCount(turtle.getSelectedSlot())
- end
- end
- end
- function rowOne()
- Restock()
- for i=1, length, 1 do
- PlaceAndCheck()
- turtle.back()
- end
- PlaceAndCheck()
- turtle.turnRight()
- turtle.back()
- PlaceAndCheck()
- turtle.turnRight()
- turtle.back()
- end
- function rowTwo()
- Restock()
- for i=1, length, 1 do
- PlaceAndCheck()
- turtle.back()
- end
- PlaceAndCheck()
- turtle.turnLeft()
- turtle.back()
- PlaceAndCheck()
- turtle.turnLeft()
- turtle.back()
- end
- if rows > 0 then
- for i=1, rows, 1 do
- rowOne()
- rowTwo()
- print(string.format("Row %s", i))
- end
- else
- rowOne()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement