Posted 11 November 2014 - 10:49 AM
Hello! Im trying to make program that first builds tower, then later when wanted will add layers of alvearys+pipes. My problem is when im building tower, i run out of blocks and i want to change inventory slot and when empty i want it to take more blocks from ender chest.
Tower im making:
so far my code looks like this
So im using
to change slot, but i dont know where i should put that code, as of now it only checks slot before it starts building. Do i have to add that to every function or is there simple way to do it?
this is what iv been thinking for taking items from enderchest in slot 16
So long story short: Where do i place code that checks slots and selects new slot if no blocks on current slot?
Tower im making:
so far my code looks like this
function place()
turtle.placeDown()
end
function place2()
turtle.placeDown()
turtle.forward()
turtle.placeDown()
end
function place3()
for i=1,2 do
turtle.placeDown()
turtle.forward()
end
turtle.placeDown()
end
function place4()
for i=1,3 do
turtle.placeDown()
turtle.forward()
end
turtle.placeDown()
end
function place5()
for i=1,4 do
turtle.placeDown()
turtle.forward()
end
turtle.placeDown()
end
function left()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.turnRight()
end
function right()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.turnLeft()
end
i = 1
while turtle.getItemCount(i) <1 do
i = i + 1
turtle.select(i)
end
local x = 0
term.write("How high tower?")
x = read()
turtle.up()
for i=1, x do
for i=1, 4 do
place5()
left()
place3()
left()
place2()
left()
place()
left()
place2()
left()
place()
turtle.forward()
turtle.turnLeft()
turtle.forward()
place2()
right()
place()
right()
place2()
right()
place3()
right()
place4()
turtle.forward()
end
turtle.up()
end
turtle.turnLeft()
turtle.forward()
for i=1,x do
turtle.Down()
end
So im using
i = 1
while turtle.getItemCount(i) <1 do
i = i + 1
turtle.select(i)
end
to change slot, but i dont know where i should put that code, as of now it only checks slot before it starts building. Do i have to add that to every function or is there simple way to do it?
this is what iv been thinking for taking items from enderchest in slot 16
while turtle.getItemCount(i) <1 do
i = i + 1
turtle.select(i)
if i=16 do
turtle.placeUp()
for i=1,15 do
turtle.suckUp()
turtle.digUp()
end
end
So long story short: Where do i place code that checks slots and selects new slot if no blocks on current slot?