Jump to content




Automatic Melon/Pumpkin Farm

turtle lua utility

6 replies to this topic

Poll: Rate this program (10 member(s) have cast votes)

How would you rate this program from 1 - 10? Keep in mind that this program is made just 1 day after my first program.

You cannot see the results of the poll until you have voted. Please login and cast your vote to see the results of this poll.
Vote Guests cannot vote

#1 GalaxyMaster

  • Members
  • 16 posts

Posted 17 May 2013 - 12:07 PM

Hi ComputerCrafters,

I just finished a fully automatic melon/pumpkin farm program. This is my second ComputerCraft program and I made it just a day after my first CC program: Automatic Tree Farm. I also made a fully automatic sugar cane farm program today. Link: Automatic Sugar Cane Farm. You need to give it fuel in the first slot. If it runs out of fuel, it will stop.

Note: This program currently only works with 2 lanes of melons/pumpkins. The length of the lanes doesn't matter though.

Note: You need to set up your farm like shown in this picture. The length of the lanes doesn't matter.
Spoiler
Please note that it is very important that the turtle starts in that position and that the 4 logs (can be any solid block) at the end of the lanes are there. The 4 logs (or any solid block) keep the melons/pumpkins from growing at those places. When that happens, the turtle won't mine them. Also, when it asks you for the length when you start it, it means the length of the dirt blocks holding the plants.


How to install:
Spoiler

Version history:
Spoiler

Screenshots:
Spoiler

Code:
Spoiler

Be sure to leave feedback and report any bugs you encounter. If you have questions feel free to ask them.

#2 unobtanium

  • Members
  • 505 posts

Posted 17 May 2013 - 01:13 PM

Here too:

if turtle.detect() then
  turtle.dig()
end
turtle.forward()

Much simpler! And you should really get into the for-loops and/or function stuff. They are really easy to copy-paste over and making programming a lot faster.
All these turtle.forward()s can be removed like this:
for i=1,3 do -- lets the turtle move 3 blocks forward
turtle.forward
end

And instead of making a for loop every time you can make a for loop into a function and just load up the function:

function moveForward(length)
for i=1,length do
  turtle.forward()
end
end

moveForward(3) --lets the turtle move 3 blocks forward
moveForward(100) -- lets the turtle move 100 blocks forward


#3 GalaxyMaster

  • Members
  • 16 posts

Posted 17 May 2013 - 02:57 PM

UPDATE: 1.1 - minor coding changes thanks to UNOBTANIUM and added a 1 minute wait after each lane switch.

#4 unobtanium

  • Members
  • 505 posts

Posted 17 May 2013 - 03:20 PM

Btw, you can name a function like you want to. moveForward was just an example. If you want to you can just name it f() and it would work as well ;D

#5 GalaxyMaster

  • Members
  • 16 posts

Posted 17 May 2013 - 03:31 PM

 UNOBTANIUM, on 17 May 2013 - 03:20 PM, said:

Btw, you can name a function like you want to. moveForward was just an example. If you want to you can just name it f() and it would work as well ;D
I know. I'm also very new to programming in general. So I won't really come up with complex stuff to solve problems.

#6 mz2212

  • Members
  • 8 posts

Posted 09 August 2013 - 02:46 AM

One minor Improvement (for people that use no fuel mode)
Before:
    while turtle.getFuelLevel() <= 20 do
	  turtle.select(1)
	  turtle.refuel(1)
    end

After:
  if turtle.getFuelLevel() < 20 then
    turtle.select(1)
    turtle.refuel(1)
  else
    sleep(0.1)
  end

what it does is makes it so that if someone has the config set to unlimited fuel it wont throw an error

#7 Phoenix

  • Members
  • 3 posts

Posted 20 August 2013 - 02:43 AM

Oh lol, I have a farm program too, but yours looks pretty good.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users