Hey guys, I just started doing some coding on a turtle. What I want the turtle to do is to break the block infront of it, select the right slot (1 or 2) and place that item (I will always have 1 item of the block that is getting mined, and 2 of the other in the turtles inventory).
 
I have it to break and place what is in slot 1 if there is a redstone signal applied from the left side and break and place what is in slot 2 if there is a redstone signal applied from the right side.
But it randomly stops working. So it does nothing when I press the button next to the turtle.
 
Here is the bit of code I wrote (remember, I never did any coding at all ;s)
 
	
	
	
		
 
Two ingame pictures here:
 
	
	
		
			
	
 
For the function Track() I have this select(1) because if slot 2 is selected and the turtle breaks a block the item goes to slot 3 rather than slot 1 where there is already this item
 
 
 
Can anyone explain to me why it randomly stops working? There is no error or something showing up in the turtle.
 
 
 
 
 
 
(Somehow this whole wall of text looks like it makes no sense ._.)
				
			I have it to break and place what is in slot 1 if there is a redstone signal applied from the left side and break and place what is in slot 2 if there is a redstone signal applied from the right side.
But it randomly stops working. So it does nothing when I press the button next to the turtle.
Here is the bit of code I wrote (remember, I never did any coding at all ;s)
		Code:
	
	function Cargo()
  turtle.select(1)
  sleep(.25)
  turtle.dig()
  sleep(.25)
  turtle.place()
end
 
function Track()
  turtle.select(1)
  sleep(.25)
  turtle.dig()
  sleep(.25)
  turtle.select(2)
  sleep(.25)
  turtle.place()
end
 
while true do
os.pullEvent("redstone")
  if redstone.getInput("right") then
    Cargo()
  end
 
os.pullEvent("redstone")
  if redstone.getInput("left") then
    Track()
  end
 
end
	Two ingame pictures here:
What the turtle's work place looks like
 
		
		
	
	
		
	
 
What the turtle's inventory looks like
 
		
	
		What the turtle's inventory looks like
For the function Track() I have this select(1) because if slot 2 is selected and the turtle breaks a block the item goes to slot 3 rather than slot 1 where there is already this item
Can anyone explain to me why it randomly stops working? There is no error or something showing up in the turtle.
(Somehow this whole wall of text looks like it makes no sense ._.)