--[[ VARIABLES ]]-- --[[ FUNCTIONS ]]-- function woodSlot() a = 1 local b = turtle.getItemCount(a) if b == 0 then a = a+1 turtle.select(a) end end --[[ MAIN CODE ]]-- while true do if turtle.back() == true then turtle.place() elseif turtle.back() == false then turtle.turnRight() end woodSlot() end
Turtle Program only goes to the second slot when out of blocks, doesn't switch to third and so on
Started by n1ghtk1ng, Jan 05 2013 07:49 AM
3 replies to this topic
#1
Posted 05 January 2013 - 07:49 AM
I made a turtle program to make a platform levels for my "factory" in Feed-The-Beast. Every time it runs out of blocks in a slot, I wanted it to switch to the next slot, but it only switches from the first slot to the second slot. How can I fix this?
#2
Posted 05 January 2013 - 07:51 AM
every time you run the woodSlut function you reset the value to 1, define a = 1 in the "--[[ VARIABLES ]]--" !
#3
Posted 05 January 2013 - 07:54 AM
move a = 1 out of the woodSlot() function, it keeps resetting to 1 and then if the amount in slot a is 0 it increases it but then resets back to 1
--[[ VARIABLES ]]-- --[[ FUNCTIONS ]]-- a = 1 function woodSlot() local b = turtle.getItemCount(a) if b == 0 then a = a+1 turtle.select(a) end end --[[ MAIN CODE ]]-- while true do if turtle.back() == true then turtle.place() elseif turtle.back() == false then turtle.turnRight() end woodSlot() end
#4
Posted 05 January 2013 - 08:37 AM
remiX, on 05 January 2013 - 07:54 AM, said:
move a = 1 out of the woodSlot() function, it keeps resetting to 1 and then if the amount in slot a is 0 it increases it but then resets back to 1
--[[ VARIABLES ]]-- --[[ FUNCTIONS ]]-- a = 1 function woodSlot() local b = turtle.getItemCount(a) if b == 0 then a = a+1 turtle.select(a) end end --[[ MAIN CODE ]]-- while true do if turtle.back() == true then turtle.place() elseif turtle.back() == false then turtle.turnRight() end woodSlot() end
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











