Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- input = {...}
- wallLength = tonumber(input[1])
- wallHeight = tonumber(input[2])
- -- The starting slot to look for building materials (from left to right, top to bottem)
- --ie. 1 2 3
- -- 4 5 6
- -- 7 8 9
- currentSlot = 1
- -- This is a function, it is peice of script that we will run later.
- -- If this inventory slot runs out of building blocks, move to the next slot.
- function gotoNextSlotIfEmpty()
- if turtle.getItemCount(currentSlot) == 0 then
- currentSlot = currentSlot + 1
- turtle.select(currentSlot)
- end
- end
- -- This is where the code starts running.
- turtle.select(currentSlot)
- turtle.up()
- for height = 1, wallHeight do
- for length = 1, wallLength do
- turtle.placeDown()
- gotoNextSlotIfEmpty() -- This call runs the function above, functions must be placed above where they are used.
- if length ~= wallLength then -- ~= means 'not equal'
- turtle.forward()
- end
- end
- if height ~= wallHeight then
- turtle.turnRight()
- turtle.turnRight()
- turtle.up()
- end
- end
Add Comment
Please, Sign In to add comment