Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("How far do you want me to build?")
- local distance = tonumber(read())
- print("How wide do you want me to build?")
- local width = tonumber(read())
- local blocksleft = width*distance
- term.clear()
- term.setCursorPos(0,0)
- print("Are you sure? Press any key to continue.")
- print("Total Blocks To Place: "..blocksleft)
- local blocksininv = 0
- for i=1,16 do
- blocksininv = blocksininv + turtle.getItemCount(i)
- end
- print("Blocks in Inventory: "..blocksininv)
- if blocksininv < blocksleft then
- local blocksshort = blocksleft-blocksininv
- print("Blocks Short: "..blocksshort)
- end
- local projcomp = string.format("%0.1f",blocksininv/blocksleft)
- print("Projected Completion: "..projcomp.."%")
- os.pullEvent("key")
- local function placeDown()
- local notified = false
- while true do
- if turtle.getItemCount() == 0 then
- for itemslot=1,15 do
- turtle.select(itemslot+1)
- if turtle.getItemCount() > 0 then
- turtle.transferTo(itemslot)
- end
- end
- end
- turtle.select(1)
- if turtle.getItemCount() > 0 then
- break
- else
- if not notified then
- rednet.send(411,{
- MsgType = "Notification",
- Title = "Out of Blocks.",
- Body = os.getComputerLabel().." is out of blocks."
- })
- notified = true
- print("Out of blocks")
- end
- end
- end
- turtle.placeDown()
- blocksleft = blocksleft - 1
- term.clear()
- term.setCursorPos(0,0)
- local totalbl = width*distance
- print("Currently Placing Blocks")
- print("Width: "..width)
- print("Distance: "..distance)
- print("Total Blocks: "..totalbl)
- print("Blocks Left: "..blocksleft)
- local completion = string.format("%0.1f",((totalbl-blocksleft)/totalbl)*100)
- print("Completion: "..completion.."%")
- local blocksininv = 0
- for i=1,16 do
- blocksininv = blocksininv + turtle.getItemCount(i)
- end
- print("Blocks in Inventory: "..blocksininv)
- if blocksleft-blocksininv > 0 then
- print("Blocks Needed: "..blocksleft-blocksininv)
- end
- end
- turtle.forward()
- placeDown()
- turtle.turnRight()
- for d=1,distance do
- for w=1,width-1 do
- turtle.forward()
- placeDown()
- end
- if d ~= distance then
- if d % 2 ~= 0 then
- turtle.turnLeft()
- turtle.forward()
- placeDown()
- turtle.turnLeft()
- else
- turtle.turnRight()
- turtle.forward()
- placeDown()
- turtle.turnRight()
- end
- end
- end
RAW Paste Data