Posted 05 January 2013 - 11:21 AM
I hope the title isn't misleading. I made a program that makes the outline of my tower, layer by layer, the design is like this :
M = marble
B = stone Bricks
BMMMB and so on.
For some reason, whenever it runs out of blocks, it doesn't switch to the next slot(even though I have a function that does so)
M = marble
B = stone Bricks
BMMMB and so on.
For some reason, whenever it runs out of blocks, it doesn't switch to the next slot(even though I have a function that does so)
--[[ VARIABLES ]]--
local slot = 1
local b = turtle.getItemCount(slot)
local turn = 0
local running = true
--[[ FUNCTIONS ]]--
function switchBrick()
BrickSlot1 = 1
BrickSlot2 = 3
BrickSlot3 = 5
slot = BrickSlot1
turtle.select(slot)
if turtle.select(slot) == true and b == false then
slot = BrickSlot2
if turtle.select(slot) == true and b == false then
slot = BrickSlot3
if turtle.select(slot) == true and b == false then
running = false
print("Out of Stone Bricks!")
end
end
end
end
function switchMarble()
MarbleSlot1 = 2
MarbleSlot3 = 4
MarbleSlotA = 6,16
slot = MarbleSlot1
if turtle.select(slot) == true and b == false then
slot = MarbleSlot3
if turtle.select(slot) == true and b == false then
slot = 6
if turtle.select(slot) == true and b == false then
slot = 7
if turtle.select(slot) == true and b == false then
running = false
end
end
end
end
end
function towerMain()
switchBrick()
turtle.back()
turtle.place()
switchMarble()
turtle.back()
turtle.place()
turtle.back()
turtle.place()
end
--[[ MAIN CODE ]]--
while running do
towerMain()
if turtle.back() == false then
turtle.turnLeft()
turn = turn + 1
end
turtle.place()
if turn == 4 then
turtle.up()
turtle.back()
turtle.turnLeft()
turn = 0
end
end