 
                
                47 posts
                
             
            
                Posted 14 April 2013 - 08:32 AM
                Hello,
I am trying to make a program that will Place a Torch then move Forward and place another.
So… could anyone Help me?
Thanks.
                
             
         
        
        
            
            
                
                     
                
                645 posts
                
                    
                        Location
                        'Merica
                    
                
             
            
                Posted 14 April 2013 - 08:41 AM
                Easy
turtle.refuel(1) -- Make sure you have fuel :P/>/>/>/>
turtle.place(2,4)  -- Make sure the torch is on slot 2-4 so you don't run out easy
turtle.forward()
Now to make that constant, do "while true do" or "for i = 1, <How many times you want the turtle to move> do"  then make sure for both of those to do "end" at the end of your code.  Or if you want to know more about .turtle API go 
hereSO it should look like this when doing the for loop
turtle.refuel -- Either have the turtle fully fueled, or input this into the for loop
for i = 1,20 do -- You can change 20 anytime, but the 20 means how long it will travel
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.place(2,4)  -- Make sure your torches are in slots 2-4.
  turtle.turnRight()
  turtle.turnRight()
  turtle.forward()
end
Its basically the same if your doing a while true do loop, but I do not recommend it.  Since with the for loop you have more control with your turtle.
 
         
        
        
            
            
                
                     
                
                1511 posts
                
                    
                        Location
                        Pennsylvania
                    
                
             
            
                Posted 14 April 2013 - 08:45 AM
                Make sure the turtle is one block away from the block it is facing or else turtle.place will return false.
                
             
         
        
        
            
            
                
                     
                
                47 posts
                
             
            
                Posted 14 April 2013 - 09:12 AM
                Easy
turtle.refuel(1) -- Make sure you have fuel :P/>/>/>/>
turtle.place(2,4)  -- Make sure the torch is on slot 2-4 so you don't run out easy
turtle.forward()
Now to make that constant, do "while true do" or "for i = 1, <How many times you want the turtle to move> do"  then make sure for both of those to do "end" at the end of your code.  Or if you want to know more about .turtle API go 
hereSO it should look like this when doing the for loop
turtle.refuel -- Either have the turtle fully fueled, or input this into the for loop
for i = 1,20 -- You can change 20 anytime, but the 20 means how long it will travel
  turtle.turnLeft()
  turtle.turnLeft()
  turtle.place(2,4)  -- Make sure your torches are in slots 2-4.
  turtle.turnRight()
  turtle.turnRight()
  turtle.forward()
end
Its basically the same if your doing a while true do loop, but I do not recommend it.  Since with the for loop you have more control with your turtle.
My Code is:
turtle.refuel(1)
for i = 1,20
   turtle.turnLeft()
   turtle.turnLeft()
   turtle.place(2, 4)
   turtle.turnRight()
   turtle.turnRight()
   turtle.forward()
end
That does not work for me.
 
         
        
        
            
            
                
                     
                
                1511 posts
                
                    
                        Location
                        Pennsylvania
                    
                
             
            
                Posted 14 April 2013 - 09:24 AM
                Replace turtle.place(2,4) with
turtle.select(2)
turtle.place()
                
             
         
        
        
            
            
                
                     
                
                47 posts
                
             
            
                Posted 14 April 2013 - 09:42 AM
                Also, I get an error saying
"bios:337: [string "Torch"]:3: 'do' expected"
My Code:
 
turtle.refuel(1)
for i = 1,20
   turtle.turnLeft()
   turtle.turnLeft()
   
   turtle.select(2)
   turtle.place()
   turtle.turnRight()
   turtle.turnRight()
   turtle.forward()
end
Could you help me with that?
                
             
         
        
        
            
            
                
                     
                
                2088 posts
                
                    
                        Location
                        South Africa
                    
                
             
            
                Posted 14 April 2013 - 09:43 AM
                For I = 1, 20 do
You left the do out
                
             
         
        
        
            
            
                
                     
                
                47 posts
                
             
            
                Posted 14 April 2013 - 09:50 AM
                A Big Thank you to all of you guys!
I have got it working!
Great Thanks!