 
                
                10 posts
                
             
            
                Posted 01 March 2014 - 07:57 AM
                hey guys so continuing on with the strip mining program, i have completely re-written the entire code, restructured the code  so it is a lot cleaner, im having a problem with the torches not placing, here is the pastebin link for testing and hopefully bug fixes 
http://pastebin.com/Gs3pgpvP :D/>  
         
        
        
            
            
                
                     
                
                1281 posts
                
             
            
                Posted 01 March 2014 - 09:39 AM
                i is not defined yet at this point in the code.
if i%6 == 0 then		  -- problem is here
	    turtle.select(2)
	    turtle.placeDown()
	    turtle.select(1)
end
 
         
        
        
            
            
                
                     
                
                10 posts
                
             
            
                Posted 01 March 2014 - 10:14 AM
                i is not defined yet at this point in the code.
if i%6 == 0 then		  -- problem is here
	    turtle.select(2)
	    turtle.placeDown()
	    turtle.select(1)
end
what should I define it to? still a noon here, are their any other bugs visible
 
         
        
        
            
            
                
                     
                
                1281 posts
                
             
            
                Posted 01 March 2014 - 10:16 AM
                I don't know what you intend to use i for, that's your job to know.
 still a noon here
wat?
I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.
 
         
        
        
            
            
                
                     
                
                10 posts
                
             
            
                Posted 01 March 2014 - 10:24 AM
                I don't know what you intend to use i for, that's your job to know.
still a noon here
wat?
I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.
noob* (auto correct)
at the moment the only bug visible is its not placing torches down. from what I can see, only been "coding" for 5-6 days now still learning so my apologies.
I don't know what you intend to use i for, that's your job to know.
still a noon here
wat?
I can't point out bugs to you unless you explicitly tell me what's wrong ie "this function dosen't do what i want it to", or an error code.
noob* (auto correct)
at the moment the only bug visible is its not placing torches down. from what I can see, only been "coding" for 5-6 days now still learning so my apologies.
 
         
        
        
            
            
                
                     
                
                1281 posts
                
             
            
                Posted 01 March 2014 - 10:24 AM
                I can only assume that the code i posted above is the one responsible for placing torches, so it's a given that won't work…
                
             
         
        
        
            
            
                
                     
                
                10 posts
                
             
            
                Posted 01 March 2014 - 12:08 PM
                I can only assume that the code i posted above is the one responsible for placing torches, so it's a given that won't work…
Yeah it is ill, edit the pastebin link with comments of what everything does.. didnt think about that before posting. has now been updated. it does work for now, only it doesnt place torches, and i have implemented it dumping its inventory into a chest yet. that is my next task after i fix the torch issue
 
         
        
        
            
            
                
                     
                
                7083 posts
                
                    
                        Location
                        Tasmania (AU)
                    
                
             
            
                Posted 01 March 2014 - 12:24 PM
                If you took this code:
if i%6 == 0 then          -- problem is here   
        turtle.select(2)
        turtle.placeDown()
        turtle.select(1)
end
for i = 1, 100 do                      
        mine()
end
And restructured it like this (so the code to place torches is 
inside the "for" loop, like how you 
originally proposed):
for i = 1, 100 do                      
	mine()
	if i%6 == 0 then
		turtle.select(2)
		turtle.placeDown()
		turtle.select(1)
	end
end
… then 'i' would conveniently have a value that automatically goes up with every block the turtle mines forward. The "for" loop uses it as a counter, you see, to keep track of which iteration it's up to.