also here is a pastebin link if you want to use this program.
edit: just noticed that there are stll some of my own comments in there sorry about that :P/>/>
http://pastebin.com/xnmQqL4W for version 1.4
If you do find a problem please tell me what it is so I can fix it instead of just telling me there is a problem.
if there are any fetures that you would like added please tell me.
features to be added
1)if not enough blocks of the correct type will pause and wait for more.
eta) 1-2 weeks im fairly busy with work at the moment.
function instructions()
--here are the instructions for the program.
print "please place 1 of the material you want the floor made from in slot 13"
print "please place 1 of the item you want the walls made out of in slot 14"
print "please place 1 of the item you want to make the roof our of in slot 15"
print "please place fuel in slot 16"
end
-- investigate ways to shrink this code
-- this is my function to compair the
-- items in the first 12 slots of the turtle
-- capable of compairing to any slot in the turtle
-- need to make a check to make sure it
-- is not compairing to itself.
function comp(t)
turtle.select(1)
if turtle.compareTo(t) == true
then s = 1
return s
else turtle.select(2)
end
if turtle.compareTo(t) == true
then s = 2
return s
else turtle.select(3)
end
if turtle.compareTo(t) == true
then s = 3
return s
else turtle.select(4)
end
if turtle.compareTo(t) == true
then s = 4
return s
else turtle.select(5)
end
if turtle.compareTo(t) == true
then s = 5
return s
else turtle.select(6)
end
if turtle.compareTo(t) == true
then s = 6
return s
else turtle.select(7)
end
if turtle.compareTo(t) == true
then s = 7
return s
else turtle.select(8)
end
if turtle.compareTo(t) == true
then s = 8
return s
else turtle.select(9)
end
if turtle.compareTo(t) == true
then s = 9
return s
else turtle.select(10)
end
if turtle.compareTo(t) == true
then s = 10
return s
else turtle.select(11)
end
if turtle.compareTo(t) == true
then s = 11
return s
else turtle.select(12)
end
if turtle.compareTo(t)
then s = 12
return s
else print "no valid materials"
end
end
--this function allows for the choosing
-- of the dimensions of the building
function getDim(x,y,z)
print "please enter desired length:"
l = io.read()
print "please enter desired width:"
w = io.read()
print "please enter desired height:"
h = io.read()
print (l..w..h)
return l, w, h
end
--floor building function
function floor(x,t,c )
t = 13
comp(t,c)
c = s
for i = 1, x do
turtle.digDown()
turtle.placeDown()
if turtle.getItemCount(c) == 0
then comp(t,c)
c = s
end
forward()
end
for i = 1, x do
turtle.back()
end
turtle.turnRight()
forward()
turtle.turnLeft()
fuel(c)
end
--wall building function
function walls(x,y,t,c)
t = 14
comp(t,c)
c = s
turtle.placeDown()
for k = 1 , x-1
do forward()
turtle.placeDown()
if turtle.getItemCount(c) == 0
then comp(t,c)
c = s
end
fuel(c)
end
turtle.turnRight()
forward()
for i = 1 , y-2
do if turtle.getItemCount(c) == 0
then comp(t,c)
c = s
end
turtle.placeDown()
forward()
end
fuel(c)
turtle.turnRight()
end
-- this is the function to make the roof
function roof(x,y,t,c)
t = 15
comp(t,c)
c = s
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.down()
for i = 1 , x-2
do for j = 1, y-2
do if turtle.getItemCount(c) == 0
then
comp(t,c)
c = s
end
turtle.placeDown()
turtle.forward()
end
for k= 1, y-2
do turtle.back()
end
turtle.turnLeft()
forward()
turtle.turnRight()
end
end
-- refueling function
function fuel(c)
if turtle.getFuelLevel() <=500
then turtle.select(16)
turtle.refuel(2)
print(turtle.getFuelLevel())
turtle.select(c)
end
end
-- functions included to reduce lines of code
-- and to allow for a stuck check
function forward()
if turtle.forward() ~= true
then turtle.dig() turtle.forward()
end
end
function up()
if turtle.up() ~= true
then turtle.digup()
turtle.up()
fuel(c)
else fuel(c)
end
end
-- main program
local x, y, z, t, c
instructions()
--sleep(7)
getDim()
x = l
y = w
z = h
print (x..y..z)
for j= 1, y do
floor(x,t,c)
end
turtle.turnLeft()
for j= 1, y do
forward()
end
turtle.turnRight()
up()
for l= 1 , z
do
for m = 1 , 2
do
walls(x,y,t,c)
end
up()
end
roof(x,y,t,c)
turtle.turnRight()
for i = 1 , x
do forward()
end
turtle.turnRight()
forward()
turtle.turnLeft()
for j = 1 . z
do turtle.down
end