If there is any criticism for my program, please let me know. I just started learning lua for this and I know I have plenty of room to improve my coding.
Also, this forum post completly ruins my code formatting, making it look like garbage. Here's the pastbin link that makes it look much more clear.
http://pastebin.com/MH1JNqpJ
--coded by ccrraazzyyman.
--Do what you want with this code, just give me credit if you
--use it :D/>/>
slot = 1
print("Direwolf20's 9x9 House builder")
print("Slots 1-3 = Walls (2.5 Stacks)")
print("Slot 4 = Floor (49 blocks)")
print("Slot 5 = Ceiling Middle (33 blocks)")
print("Slot 6 = Glass (16 blocks)")
print("Press any key to start")
io.read()
function wall9()
digg()
for x=1, 9, 1 do
turtle.forward()
digDown()
placeDown()
digg()
end
end
function wall8()
digg()
for x=1, 8, 1 do
turtle.forward()
digDown()
placeDown()
digg()
end
end
function wall7()
digg()
for x=1, 7, 1 do
turtle.forward()
digDown()
placeDown()
digg()
end
end
function layer()
turtle.up()
wall9()
turtle.turnRight()
wall8()
turtle.turnRight()
wall8()
turtle.turnRight()
wall7()
turtle.forward()
turtle.turnRight()
turtle.back()
print("Layer completed")
end
function ceiling()
turtle.select(5)
turtle.forward()
ceilingRow()
rightTurn()
ceilingRowGlass()
leftTurn()
ceilingRowGlass()
rightTurn()
ceilingRow()
leftTurn()
ceilingRowGlass()
rightTurn()
ceilingRowGlass()
leftTurn()
ceilingRow()
print("Ceiling Completed")
end
function ceilingRow()
for x=1, 7, 1 do
turtle.placeDown()
if x==7 then
break end
turtle.forward()
end
end
function ceilingRowGlass()
turtle.placeDown()
turtle.forward()
turtle.select(6)
for x=1, 2, 1 do
turtle.placeDown()
turtle.forward()
end
turtle.select(5)
turtle.placeDown()
turtle.forward()
turtle.select(6)
for x=1, 2, 1 do
turtle.placeDown()
turtle.forward()
end
turtle.select(5)
turtle.placeDown()
end
function floor()
turtle.select(4)
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
for x=1, 5, 1 do
turtle.down()
end
for x=1, 3, 1 do
floorRow()
rightTurn()
floorRow()
leftTurn()
end
floorRow()
for x=1, 5, 1 do
turtle.up()
end
turtle.forward()
turtle.turnLeft()
turtle.turnLeft()
print("Floor Completed")
end
function floorRow()
for x=1, 7, 1 do
digDown()
turtle.placeDown()
turtle.forward()
end
end
function rightTurn()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
end
function leftTurn()
turtle.turnLeft()
turtle.forward()
turtle.turnLeft()
end
function digg()
while turtle.detect() do
turtle.dig()
sleep(.4)
end
end
function digDown()
if turtle.detectDown() then
turtle.digDown() end
end
function detect()
turtle.select(slot)
if turtle.getItemCount(slot) == 0 then
slot = slot + 1
end
end
function place()
detect()
turtle.place()
end
function placeDown()
detect()
turtle.placeDown()
end
function goHome()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.forward()
for x=1, 5, 1 do
turtle.down()
end
print("Arriving at starting point")
end
for x=1, 5, 1 do
layer()
end
floor()
ceiling()
goHome()
print("---9x9 Completed---")