Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Minecraft > Minecraft Mods, Textures, Skins & Maps
You last visited: Today at 03:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Farm Turtle Script - FTB / ComputerCraft

Discussion on [Release] Farm Turtle Script - FTB / ComputerCraft within the Minecraft Mods, Textures, Skins & Maps forum part of the Minecraft category.

Reply
 
Old   #1
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
[Release] Farm Turtle Script - FTB / ComputerCraft

Hey there,

I'm not usually in this section, so you'll have to pardon me for only knowing English. I was just burning time at the lab I work in, and I made a small script for the turtle robot in feed the beast. Before I post the code, be aware that there are betters ways to do this. If I redo the project, I would change the shape of the field into something more efficient, same with the starting position of the turtle. Anyways, here's the field:







Behind the scenes, you can see that coal is pumped into a chest on the top of the turtle. The turtle should have seeds in the first slot of the turtle. Coal can be anywhere in the turtle for fuel. If there is no fuel to continue, the turtle will stop and wait for fuel.





Here's the script:
Also, below:

Code:
-- Configuration:
seedsSlot = 1

-- Checks if the fuel level is low and refuels. Finds fuel
-- in the turtle's inventory.
checkFuel = function()
	while turtle.getFuelLevel() < 1 do
		for s = 2, 16 do
			if turtle.select(s) then
				if turtle.getFuelLevel() < 1 then
					turtle.refuel(s)
				else break
				end
			end
		end
	
		-- Alert the user if the turtle is out of fuel.
		if turtle.getFuelLevel() < 1 then
			print("Warning - out of fuel.")
			sleep(5)
		end
	end
end

-- Prepares the seeds slot to plant crop.
prepareSeeds = function()
	turtle.select(seedsSlot)
	if turtle.getItemCount(seedsSlot) == 1 then
		for index = 2, 16 do
			if turtle.compareTo(index) then
				turtle.select(index)
				turtle.transferTo(seedsSlot, turtle.getItemCount(index))	
				turtle.select(seedsSlot)
			end
		end
	end
end

-- Takes a step forward. Checks fuel for each step.
forward = function(n)
	for index = 1, n do
		checkFuel()
		turtle.forward()
	end
end

-- Harvests the crop below the turtle, then replants the
-- crop using seeds from the configured seeds slot. Moves
-- forward to the next space if not the last space.
harvest = function(n)
	for index = 1, n do
		turtle.digDown()
		turtle.suckDown()
		prepareSeeds()
		turtle.placeDown()
		if index ~= n then
			forward(1)
		end	
	end
end

-- Turns the turtle to the right.
right = function()
	turtle.turnRight()
end

-- Turns the turtle to the left.
left = function()
	turtle.turnLeft()
end

-- Makes the turtle turn around.
uturn = function()
	turtle.turnLeft()
	turtle.turnLeft()
end

-- Dumps the inventory into the chest below it.
dump = function()
	for s = 2, 16 do
		if turtle.select(s) then
			turtle.dropDown(turtle.getItemCount(s))
		end
	end
end

-- Gets fuel from the chest above it.
getFuel = function()
	for s = 2, 16 do
		if turtle.select(s) and turtle.getItemCount(s) == 0 then
			turtle.suckUp()
			break
		end
	end
end

-- Output the header for the program
print("Farming Turtle Program")
print("Developed by Spirited Fang")
print(" ")
print("Obtaining Fuel...")
getFuel()

print("Now farming left side...")
forward(1)
left()
forward(3)
harvest(5)
right()
forward(1)
right()
harvest(7)
left()
forward(1)
left()
harvest(7)
right()
forward(1)
right()
harvest(5)
left()
forward(1)
left()
forward(1)
harvest(4)
right()
forward(1)
right()
harvest(3)
left()
forward(1)
left()
harvest(3)
right()
forward(1)
right()
harvest(3)
left()
forward(1)
left()
harvest(3)
right()
forward(1)
right()
harvest(3)
forward(1)
left()
forward(1)
left()
harvest(4)
right()
forward(1)
right()
harvest(5)
forward(2)
left()
forward(1)
left()
harvest(7)
right()
forward(1)
right()
harvest(7)
left()
forward(1)
left()
harvest(7)
uturn()
forward(8)

print("Now farming right side...")
harvest(7)
right()
forward(1)
right()
harvest(7)
left()
forward(1)
left()
harvest(7)
right()
forward(1)
right()
harvest(5)
left()
forward(1)
left()
forward(1)
harvest(4)
right()
forward(1)
right()
harvest(3)
left()
forward(1)
left()
harvest(3)
right()
forward(1)
right()
harvest(3)
left()
forward(1)
left()
harvest(3)
right()
forward(1)
right()
harvest(3)
forward(1)
left()
forward(1)
left()
harvest(4)
right()
forward(1)
right()
harvest(5)
forward(2)
left()
forward(1)
left()
harvest(7)
right()
forward(1)
right()
harvest(7)
left()
forward(1)
left()
forward(2)
harvest(5)

print("Going Home...")
uturn()
forward(7)
left()
forward(2)

print("Dumping crops...")
dump()
uturn()
forward(1)
print("Task Completed.")
If you want to implement my farm, go for it. Have fun, and good luck.
Kind Regards,
Fang
Spirited is offline  
Thanks
1 User
Old 11/26/2013, 14:04   #2
 
.Elektro.'s Avatar
 
elite*gold: 0
Join Date: Jul 2009
Posts: 1,378
Received Thanks: 232
You could write that it is for ComputerCraft, FTB is the Modpack. Would be a better description.. But its a nice script!
.Elektro. is offline  
Thanks
1 User
Old 11/27/2013, 06:54   #3
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,283
Received Thanks: 4,192
Quote:
Originally Posted by .Elektro. View Post
You could write that it is for ComputerCraft, FTB is the Modpack. Would be a better description.. But its a nice script!
It's a very inefficient script. There are many places where I could optimize this, the main ones being the field layout (of course), but also some very small optimizations in the code. Thanks for the feedback though, I appreciate it. I also asked a moderator to change the thread name based on your suggestion, so thanks. Hopefully it's a bit more accurate.
Spirited is offline  
Reply


Similar Threads Similar Threads
[Release] Turtle Weapons
04/05/2013 - Flyff PServer Guides & Releases - 21 Replies
Heeey E*PvPers Hier Release ich mal die Turtle Waffen von bitcptiic (aus einem anderen Forum) Grund: Waffen sind einfach gut,deshalb wollte ich das ihr Sie auch usen könnt. http://www10.pic-upload.de/thumb/05.04.12/8iaosha 8jsi.jpg Bilder danke Reavern´s Hilfe :
Computercraft 1.5 ( ftB Launcher) Turtle hilfe
03/29/2013 - Minecraft - 3 Replies
Hallo com, Ich spiele momentan Feed the Beast, und habe mich jetzt mal bischen an an Computercraft rangetraut, Dort habe ich über ein Tutorial über die farming Turtle gesehen und alles abgeschreiben, jetzt habe ich das alles auf einer Floopy Diks, aber wie Kriege ich die Turtle dazu, das sie das macht was ich auf der disk geschreiben habe?? Bitte helft mir. Danke
[RELEASE]Ninja Saga Hunting House Battle Turtle Hack
01/05/2013 - Facebook - 1 Replies
Credits: .:: MGF® Forum ::. Tools: FIDDLER, SWF file. Download the SWF file >>here<< Steps: 1. Open Ninja Saga 2. Download Fiddler and the SWF file above
[RELEASE]NewMount-Turtle
04/08/2011 - EO PServer Guides & Releases - 30 Replies
Hello all i have make a query....query inside the zip.. this is some screenshot: http://i20.servimg.com/u/f20/15/20/13/01/turtle10 .jpg Download: please download to get turtle file



All times are GMT +1. The time now is 03:49.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.