Jump to content




Auto farming Turtle help?


2 replies to this topic

#1 Riggs Eclipse

  • New Members
  • 1 posts

Posted 22 October 2014 - 05:59 AM

So past hour or so I've been trying to get my farming turtle to automatically harvest and replant crops. Now I'm am totally new at this, like I have no experience with programming anything at all but really want to learn this kind of thing. After looking around some I've figured out how to get it to harvest and replant the crops, moving one block forward every time it does but it does so in one direction infinitely. How do I tell it to stop after a certain amount of blocks? Basically I need it to loop until it gets to a certain point then stopping.

while true do
turtle.forward(1)
turtle.digDown(1)
turtle.placeDown(1)
end

That's all I have and really all I know how to do sooo... Anyone can help out the new guy I'd appreciate it! And if I'm formatting this wrong I sincerely apologize I just got my account like two minutes ago hehe

#2 com_kieffer

  • Members
  • 14 posts

Posted 22 October 2014 - 10:16 AM

local max_moves = 10
for i = 1, max_moves do
	turtle.forward(1)
	turtle.digDown(1)
	turtle.placeDown(1)
end

Just change the value of max_moves to the the number of times you want to move forwards.

Edited by com_kieffer, 22 October 2014 - 10:17 AM.


#3 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 22 October 2014 - 01:09 PM

FYI: turtle.forward, turtle.digDown, and turtle.placeDown don't accept arguments. Giving them a '1' is irrelevant to what they are going to do.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users