 
                
                5 posts
                
             
            
                Posted 12 February 2013 - 04:19 AM
                Title: [question] Invetory drop?
Question: Im playing on a FTB server, and i made a automatic spawner with mele turtles, and i wanted to automate it,
But i cant figure out how i can get the melee turtles to drop their full invetory.
My script atm:
while true do
turtle.attack()
sleep(1)
end
So i want a script some what like that, and that the turtles drop out the mob drops on my transposers,
And also i have a second question, how can i copy and paste scripts?
Thank you!
 
         
        
        
            
            
                
                     
                
                3790 posts
                
                    
                        Location
                        Lincoln, Nebraska
                    
                
             
            
                Posted 12 February 2013 - 04:23 AM
                Split to new topic.
You can use
for i = 1, 16 do
    turtle.select(i)
    turtle.drop()
end
to go through all of your slots, then drop them.
 
         
        
        
            
            
                
                     
                
                5 posts
                
             
            
                Posted 12 February 2013 - 04:30 AM
                Split to new topic.
You can use
for i = 1, 16 do
	turtle.select(i)
	turtle.drop()
end
to go through all of your slots, then drop them.
 Thank you, ill try that.
And do you now a easy way to copy and paste?
 
         
        
        
            
            
                
                     
                
                3790 posts
                
                    
                        Location
                        Lincoln, Nebraska
                    
                
             
            
                Posted 12 February 2013 - 04:32 AM
                Depends on what you mean. If you mean copy/paste into CC, then you will have to just copy one line at a time. Press the ctrl button once to bring up your menu, then use ctrl v to paste the line.
Although, I would suggest typing it yourself, so that you can get into the habit of writing the code.
                
             
         
        
        
            
            
                
                     
                
                5 posts
                
             
            
                Posted 12 February 2013 - 04:43 AM
                i tried this script:
while true do
turtle.attack()
sleep(1)
for i = 1, 16 do
turtle.select(1)
turtle.drop()
end
And it gives me this error:
bios:338: [string "startup"]:8: 'end' expected (to close 'while' at line 1)
It might be really noobie but im new to scripting :P/>
 
         
        
        
            
            
                
                     
                
                75 posts
                
             
            
                Posted 12 February 2013 - 04:54 AM
                You need an end for the while statement, and another one for the "for" loop. You only have one which terminates the for loop, leaving the while without a terminating end.
                
             
         
        
        
            
            
                
                     
                
                5 posts
                
             
            
                Posted 12 February 2013 - 05:19 AM
                You need an end for the while statement, and another one for the "for" loop. You only have one which terminates the for loop, leaving the while without a terminating end.
can you maybe tell me how the script then goes?
because i tried difrent things and none of them worked
 
         
        
        
            
            
                
                     
                
                148 posts
                
             
            
                Posted 12 February 2013 - 06:05 AM
                Example: (functionally just that one end line more, I don't know if you couldn't have added that yourself too, but you requested it…)
while true do
    for i = 1, 9 do
        turtle.attack()
        sleep(1)
    end
    for i =1, 16 do
        turtle.select(i)
        turtle.drop()
    end
end
(I added added another for-loop, because I don't like looping through every single slot just to drop one or two items, it would run without it)
 
         
        
        
            
            
                
                     
                
                5 posts
                
             
            
                Posted 12 February 2013 - 06:35 AM
                Example: (functionally just that one end line more, I don't know if you couldn't have added that yourself too, but you requested it…)
while true do
	for i = 1, 9 do
		turtle.attack()
		sleep(1)
	end
	for i =1, 16 do
		turtle.select(i)
		turtle.drop()
	end
end
(I added added another for-loop, because I don't like looping through every single slot just to drop one or two items, it would run without it)
ty, i know what my mistake was, i didn't do the double end :P/>
now that i see it it makes sense