args = {...} height = tonumber(args[1]) desireSize = tonumber(args[2]) if args[3] then hasType = true else hasType = false end workType = tostring(args[3]) blocksUsed = 1 -- Digs the required space for the build, one level function digSpace (n) for i=1, 4,1 do for i=1, n,1 do if turtle.detect() then turtle.dig() end turtle.forward() end turtle.turnRight() end end -- Digging over multiple levels function digHole (height, desireSizeOver) desireReSized = desireSizeOver - 1 for i=1, height,1 do digSpace(desireReSized) turtle.digUp() turtle.up() end for i=1, height,1 do turtle.down() end end -- Builds a wall, one block tall, leaves the turtle at origin + 1 function buildRoom (n) turtle.forward() turtle.turnLeft() turtle.turnLeft() for i=1, n-2,1 do placeBlock() turtle.back() print(i) end placeBlock() turtle.turnRight() turtle.back() -- Builds one wall segment, used for second and third segment. function buildLine (length) for i=1, length-2,1 do placeBlock() turtle.back() end placeBlock() turtle.turnRight() turtle.back() end buildLine(n) buildLine(n) for i=1, n-3,1 do placeBlock() turtle.back() end placeBlock() turtle.up() turtle.placeDown() blocksUsed = blocksUsed + 1 turtle.back() turtle.turnLeft() end -- Runs the buildRoom funtion n times to achieve desired height. function buildWalls (height, desireSize) for i=1, height,1 do buildRoom(desireSize) end end function placeBlock () turtle.place() if turtle.getItemCount() < 1 then turtle.select(turtle.getSelectedSlot() + 1) end end function usageText () print("Usage: room [Height] [Length of walls] [-d (only digs) / -b (only builds)]") print("Example: 'room 2 4 -b' builds a room that is two blocks tall, four blocks long, but does NOT dig the required space") end -- check for argument usage if (height and desireSize) then if hasType then if (workType == "-d") or (workType == "-b") then if workType == "-d" then print("Digging...") digHole(height, desireSize) else print("Building...") buildWalls(height, desireSize) end else usageText() print("debug: failed worktype") end else print("Digging and building...") digHole(height, desireSize) buildWalls(height, desireSize) end else usageText() print("debug: no argument(s)") end