This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Mendoza's profile picture

The Multi Farming Autonomous Script V2 | New features!

Started by Mendoza, 24 January 2014 - 10:04 AM
Mendoza #1
Posted 24 January 2014 - 11:04 AM
>The Multi Farming Autonomous Script V2


The overhauled and enhanced version of the MFAS V1 is out, with optimizations, bug fixes and new features:
  • New user-friendly HUD
  • Added Multi Floor mode
  • Added support for sugar canes
  • Added support for unlimited fuel mode
  • Added support for lava buckets as fuel item
  • Added a menu for the information of the last harverst
  • Now the turtle will go to the chests if it´s full or with low fuel
  • Fixed the wheat bug
  • Changed the message showed on the screen
How to build a suitable farm for the MFAS:

CLICK THE IMAGE TO ENLARGE BELOW

Spoiler




Download it from: pastebin get 26FCDSc9 MFAS


Thanks for your time, feel free to comment, rate or report any bug.


Code:

Spoiler

Multi Farming Autonomous Script V2 By Mendoza
if fs.exists("VALUES") == false then
	h = fs.open("VALUES", "w")
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(1)
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(0)
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(0)
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(0)
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(0)
	h.writeLine(0) h.writeLine(0) h.writeLine(0) h.writeLine(0)
	h.writeLine(1)
	h.close()
end
h = fs.open("VALUES", "r")
x = (tonumber(h.readLine()*1))
y = (tonumber(h.readLine()*1))
z = (tonumber(h.readLine()*1))
f = (tonumber(h.readLine()*1))
tgtx = (tonumber(h.readLine()*1))
tgty = (tonumber(h.readLine()*1))
tgtz = (tonumber(h.readLine()*1))
tgtf = (tonumber(h.readLine()*1))
distance = (tonumber(h.readLine()*1))
slot = (tonumber(h.readLine()*1))
wallslot = (tonumber(h.readLine()*1))
wall = (tonumber(h.readLine()*1))
nextturn = (tonumber(h.readLine()*1))
ufmode = (tonumber(h.readLine()*1))
items = (tonumber(h.readLine()*1))
titems = (tonumber(h.readLine()*1))
tgtfuel = (tonumber(h.readLine()*1))
ichestside = (tonumber(h.readLine()*1))
fchestside = (tonumber(h.readLine()*1))
option = (tonumber(h.readLine()*1))
mfmode = (tonumber(h.readLine()*1))
delay = (tonumber(h.readLine()*1))
runlevel = (tonumber(h.readLine()*1))
remaining = (tonumber(h.readLine()*1))
step = (tonumber(h.readLine()*1))
h.close()
ls = {}
repeat
	slot = (slot + 1)
		ls[slot] = turtle.getItemCount(slot)
until slot == 16
function save()
	h = fs.open("VALUES", "w")
	h.writeLine(x) h.writeLine(y) h.writeLine(z) h.writeLine(f)
	h.writeLine(tgtx) h.writeLine(tgty) h.writeLine(tgtz) h.writeLine(tgtf)
	h.writeLine(distance) h.writeLine(slot) h.writeLine(wallslot) h.writeLine(wall)
	h.writeLine(nextturn) h.writeLine(ufmode) h.writeLine(items) h.writeLine(titems)
	h.writeLine(tgtfuel) h.writeLine(ichestside) h.writeLine(fchestside) h.writeLine(option)
	h.writeLine(mfmode) h.writeLine(delay) h.writeLine(runlevel) h.writeLine(remaining)
	h.writeLine(step)
	h.close()
end
function forward()
	if turtle.detect() == true then matching() if wall == 0 then turtle.dig() end end
	if turtle.forward() == true then
	distance = (distance + 1)
	if f == 1 then z = (z + 1)
	elseif f == 2 then x = (x + 1)
	elseif f == 3 then z = (z - 1)
	elseif f == 4 then x = (x - 1)
	end
	end
	save()
end
function right()
	turtle.turnRight()
	if f == 4 then f = 1 else f = (f + 1) end
	save()
end
function left()
	turtle.turnLeft()
	if f == 1 then f = 4 else f = (f - 1) end
	save()
end
function up()
	if turtle.up() == true then
	distance = (distance + 1)
	y = (y + 1)
	save()
	end
end
function down()
	if turtle.down()== true then
	distance = (distance + 1)
	y = (y - 1)
	end
	save()
end
function rotate(tgtf)
	if tgtf ~= f then
		if (tgtf - 3) == f then left()
		elseif (tgtf + 3) == f then right()
		elseif tgtf < f == true
			then repeat left() until f == tgtf
			else repeat right() until f == tgtf
		end
	end
	save()
end
function firstturn()
	if nextturn == 1
		then left()
		else right()
	end
end
function secondturn()
	forward()
	if nextturn == 1
		then left()
		nextturn = 0
		else right()
		nextturn = 1
	end
end
function setup(tgtfuel)
	slot = 0
		if ichestside == 2 then rotate(2)
		elseif ichestside == 5 then rotate(3)
		elseif ichestside == 4 then rotate(4)
		end
		titems = titems + (ls[1] + ls[2] + ls[3] + ls[4] +
		ls[5] + ls[6] + ls[7] + ls[8] + ls[9] +
		ls[10] + ls[11] + ls[12] + ls[13] + ls[14]+
		ls[15] + ls[16] - 1)
		repeat
			slot = (slot + 1)
			turtle.select(slot)
			if slot ~= wallslot then
				if ichestside == 1 then turtle.dropUp()
					elseif ichestside == 3 then turtle.dropDown()
					elseif ichestside == 2 or ichestside == 4 or ichestside == 5 then turtle.drop()
				end
			end
		until slot == 16
	if tgtfuel > 0 then
		if fchestside == 2 then rotate(2)
		elseif fchestside == 5 then rotate(3)
		elseif fchestside == 4 then rotate(4)
		end
		if turtle.getFuelLevel() == "unlimited" then ufmode = 1 else ufmode = 0 end
		if ufmode == 0 then
			turtle.select(1)
			repeat
				if fchestside == 1 then turtle.suckUp()
				elseif fchestside == 3 then turtle.suckDown()
				elseif fchestside == 2 or fchestside == 4 or fchestside == 5 then turtle.suck()
				end
				repeat
					ls[1] = turtle.getItemCount(1)
					turtle.refuel(1)
					if ls[1] == turtle.getItemCount(1) then if wallslot < 16 then turtle.transferTo(wallslot + 1) else turtle.transferTo(wallslot - 1) end end
				until turtle.getFuelLevel() > tgtfuel or turtle.getItemCount(1) == 0
			until turtle.getFuelLevel() > tgtfuel
		end
		slot = 0
	repeat
		slot = (slot + 1)
		if slot ~= wallslot then
			turtle.select(slot)
			if ichestside == 1 then turtle.dropUp()
			elseif ichestside == 3 then turtle.dropDown()
			elseif ichestside == 2 or ichestside == 4 or ichestside == 5 then turtle.drop()
			end
		end
	until slot == 16
	slot = 0
	turtle.select(1)
	end
	rotate(1)
end
function go(tgtx, tgty, tgtz, tgtf)
	if y ~= tgty then
		repeat
			if x < 0 then rotate(2)
			elseif x > 0 then rotate(4)
			end
			if turtle.detect() == false and x ~= 0 then repeat forward() until x == 0 or turtle.detect() == true end
			if z < 0 then rotate(1)
			elseif z > 0 then rotate(3)
			end
			if turtle.detect() == false and z ~= 0 then repeat forward() until z == 0 or turtle.detect() == true end
			if y < tgty then if turtle.detectUp() == false then repeat up() until y == tgty or turtle.detectUp() == true end
			elseif y > tgty then if turtle.detectDown() == false then repeat down() until y == tgty or turtle.detectDown() == true end
			end
		until (x == 0) == true and (z == 0) == true and (y == tgty) == true
		repeat
			if x < tgtx then rotate(2)
			elseif x > tgtx then rotate(4)
			end
			if turtle.detect() == false and x ~= tgtx then repeat forward() until x == tgtx or turtle.detect() == true end
			if z < tgtz then rotate(1)
			elseif z > tgtz then rotate(3)
			end
			if turtle.detect() == false and z ~= tgtz then repeat forward() until z == tgtz or turtle.detect() == true end
		until (x == tgtx) == true and (z == tgtz) == true
	else
		repeat
			if z < tgtz then rotate(1)
			elseif z > tgtz then rotate(3)
			end
			if turtle.detect() == false and z ~= tgtz then repeat forward() until z == tgtz or turtle.detect() == true end
			if x < tgtx then rotate(2)
			elseif x > tgtx then rotate(4)
			end
			if turtle.detect() == false and x ~= tgtx then repeat forward() until x == tgtx or turtle.detect() == true end
		until (x == tgtx) == true and (z == tgtz) == true
	end
	rotate(tgtf)
end
function matching()
	turtle.select(wallslot)
	if turtle.compare() == true
		then wall = 1
		else wall = 0
	end
	turtle.select(1)
end
function core()
	ls = {}
	turtle.select(1)
	slot = 0
	if turtle.detectDown() == true
		then
		repeat
			slot = (slot + 1)
			ls[slot] = turtle.getItemCount(slot)
		until slot == 16
		turtle.digDown()
		slot = 0
		repeat
			slot = (slot + 1)
		until ls[slot] ~= turtle.getItemCount(slot) or slot == 16
		if wallslot ~= slot then
		turtle.select(slot)
		turtle.placeDown()
		end
		if turtle.detectDown() == false and slot ~= 16
			then
			repeat
				slot = (slot + 1)
				turtle.select(slot)
				if slot ~= wallslot then turtle.placeDown() end
			until turtle.detectDown() == true or slot == 16
		end
		slot = 0
		turtle.select(1)
	end
	matching()
	if wall == 0 and turtle.detect() == true
		then
		turtle.dig()
		turtle.suck()
		turtle.suckUp()
		turtle.suckDown()
	end
end
function info()
	term.clear()
	term.setCursorPos(1,1)
	print("[		  LAST HARVEST INFO		  ]")
	print("---------------------------------------")
	term.setCursorPos(1,3)
	print("Total blocks travelled:".. distance)
	term.setCursorPos(1,5)
	print("Total items harvested:".. titems)
	term.setCursorPos(1,12)
	print("---------------------------------------")
	term.setCursorPos(1,11)
	print("Press any key to exit")
	os.pullEvent("key")
end
function options()
	repeat
		repeat
			term.clear()
			term.setCursorPos(1,1)
			print("[		   MFAS V2 OPTIONS		   ]")
			print("---------------------------------------")
			term.setCursorPos(1,3)
			print("1-Multi floor mode")
			term.setCursorPos(1,5)
			print("2-Change sides of chests")
			term.setCursorPos(1,7)
			print("3-Change sleeping time")
			term.setCursorPos(1,9)
			print("4-Back to main menu")
			term.setCursorPos(1,11)
			print("Type the number and press enter")
			term.setCursorPos(1,12)
			print("---------------------------------------")
			term.setCursorPos(1,13)
			option = (io.read() * 1)
		until option == 1 or option == 2 or option == 3 or option == 4
		if option == 1 then
		repeat
			term.clear()
			term.setCursorPos(1,1)
			print("[		   MULTIFLOOR MODE		   ]")
			print("---------------------------------------")
			term.setCursorPos(1,3)
			print("1-Enable")
			term.setCursorPos(1,5)
			print("0-Disable")
			term.setCursorPos(1,11)
			print("Type the number and press enter")
			term.setCursorPos(1,12)
			print("---------------------------------------")
			term.setCursorPos(1,13)
			mfmode = (io.read() * 1)
		until mfmode == 1 or mfmode == 0
		elseif option == 2 then
		repeat
			term.clear()
			term.setCursorPos(1,1)
			print("[		   FUEL CHEST SIDE		   ]")
			print("---------------------------------------")
			term.setCursorPos(1,3)
			print("1-Up")
			term.setCursorPos(1,4)
			print("2-Right")
			term.setCursorPos(1,5)
			print("3-Bottom")
			term.setCursorPos(1,6)
			print("4-Left")
			term.setCursorPos(1,7)
			print("5-Back")
			term.setCursorPos(1,11)
			print("Type the number and press enter")
			term.setCursorPos(1,12)
			print("---------------------------------------")
			term.setCursorPos(1,13)
			fchestside = (io.read() * 1)
		until fchestside == 1 or fchestside == 2 or fchestside == 3 or fchestside == 4 or fchestside == 5
		repeat
			term.clear()
			term.setCursorPos(1,1)
			print("[		   ITEM CHEST SIDE		   ]")
			print("---------------------------------------")
			term.setCursorPos(1,3)
			print("1-Up")
			term.setCursorPos(1,4)
			print("2-Right")
			term.setCursorPos(1,5)
			print("3-Bottom")
			term.setCursorPos(1,6)
			print("4-Left")
			term.setCursorPos(1,7)
			print("5-Back")
			term.setCursorPos(1,11)
			print("Type the number and press enter")
			term.setCursorPos(1,12)
			print("---------------------------------------")
			term.setCursorPos(1,13)
			ichestside = (io.read() * 1)
			until (ichestside == 1 or ichestside == 2 or ichestside == 3 or ichestside == 4 or ichestside == 5) == true and fchestside ~= ichestside
		elseif option == 3 then
		repeat
			term.clear()
			term.setCursorPos(1,1)
			print("[			SLEEPING TIME			]")
			print("---------------------------------------")
			print("Hours between harvests? Can be a decimal number using a dot.")
			print("")
			print("i.e 0.5 -> 30 minutes")
			term.setCursorPos(1,13)
			delay = (io.read() * 1)
		until delay >= 0
		end
	until option == 4
end
function gui()
	repeat
		term.clear()
		term.setCursorPos(1,1)
		print("[			   MFAS V2			   ]")
		print("---------------------------------------")
		term.setCursorPos(1,3)
		print("1-Run now")
		term.setCursorPos(1,5)
		print("2-Options")
		term.setCursorPos(1,7)	
		print("3-Last harvest info")
		term.setCursorPos(1,9)
		print("4-Close MFAS")
		term.setCursorPos(1,11)
		print("Type the number and press enter")
		term.setCursorPos(1,12)
		print("---------------------------------------")
		term.setCursorPos(1,13)
		repeat
			term.setCursorPos(1,13)
			option = io.read()*1
		until option == 1 or option == 2 or option == 3 or option == 4
		if option == 2 then
			options()
		elseif option == 3 then
			info()
		elseif option == 4 then
			save()
			term.clear()
			term.setCursorPos(1,1)
			print("Thanks for using MFAS - Mendoza")
			sleep(3)
			os.reboot()
		end
	until option == 1
	term.clear()
end
function main()
	turtle.dig()
	forward()
	rotate(4)
	matching()
	if turtle.detect() == true and wall == 1
		then
		nextturn = 0
		else
		nextturn = 1
	end	
	rotate(1)
	while true do
	save()
	core()
	if (turtle.getFuelLevel() == ((math.abs(x)) + (math.abs(y)) + (math.abs(z)) + 50) and ufmode == 0) == true then
		tgtx = x
		tgty = y
		tgtz = z
		tgtf = f
		go(0, 0, 0, 1)
		setup(1000)
		go(tgtx, tgty, tgtz, tgtf)
	elseif full() == true then
		tgtx = x
		tgty = y
		tgtz = z
		tgtf = f
		go(0, 0, 0, 1)
		setup(0)
		go(tgtx, tgty, tgtz, tgtf)
		end
	save()
	if turtle.detect() == false
		then
		forward()
		turtle.suckDown()
		else
		turtle.suckDown()
		firstturn()
		matching()
		if turtle.detect() == true and wall == 1
		then break
		else
		if wall == 0 and turtle.detect() == true
		then
			turtle.dig()
			turtle.suck()
			turtle.suckUp()
			turtle.suckDown()
		end
		secondturn()
		end
	end
	end
	go(0, y, 0, 1)
end
function wait()
	term.clear()
	if remaining <= 0 then remaining = (delay*3600) end
	repeat
		remaining = remaining - 1
		save()
		sleep(1)
	until remaining <= 0
	term.clear()
	step = 1
	save()
end
function full()
	if wallslot == 16 then
		if turtle.getItemCount(15) > 0 then return true
		else return false end
	elseif wallslot ~= 16 then
		if turtle.getItemCount(16) > 0 then return true
		else return false end
	end
end
save()
if runlevel == 0 then
term.clear()
term.setCursorPos(1,1)
print("[			   MFAS V2			   ]")
print("---------------------------------------")
term.setCursorPos(1,3)
print("Welcome to MFAS V2. Please, add to the inventory of the turtle the block which are made the walls of the farm, and press a key")
os.pullEvent("key")
	repeat
		wallslot = (wallslot + 1)
		turtle.select(wallslot)
	until turtle.getItemCount(wallslot) > 0
if wallslot == 1 then
	wallslot = 16
	turtle.select(1)
	turtle.transferTo(16)
	turtle.select(1)
end
turtle.select(1)
term.clear()
term.setCursorPos(1,1)
print("[			   MFAS V2			   ]")
print("---------------------------------------")
term.setCursorPos(1,3)
print("Before starting, set the options in the next page")
os.pullEvent("key")
repeat
	term.clear()
	term.setCursorPos(1,1)
	print("[		   MULTIFLOOR MODE		   ]")
	print("---------------------------------------")
	term.setCursorPos(1,3)
	print("1-Enable")
	term.setCursorPos(1,5)
	print("0-Disable")
	term.setCursorPos(1,11)
	print("Type the number and press enter")
	term.setCursorPos(1,12)
	print("---------------------------------------")
	term.setCursorPos(1,13)
	mfmode = (io.read() * 1)
until mfmode == 1 or mfmode == 0
save()
repeat
	term.clear()
	term.setCursorPos(1,1)
	print("[		   FUEL CHEST SIDE		   ]")
	print("---------------------------------------")
	term.setCursorPos(1,3)
	print("1-Up")
	term.setCursorPos(1,4)
	print("2-Right")
	term.setCursorPos(1,5)
	print("3-Bottom")
	term.setCursorPos(1,6)
	print("4-Left")
	term.setCursorPos(1,7)
	print("5-Back")
	term.setCursorPos(1,11)
	print("Type the number and press enter")
	term.setCursorPos(1,12)
	print("---------------------------------------")
	term.setCursorPos(1,13)
	fchestside = (io.read() * 1)
until fchestside == 1 or fchestside == 2 or fchestside == 3 or fchestside == 4 or fchestside == 5
save()
repeat
	term.clear()
	term.setCursorPos(1,1)
	print("[		   ITEM CHEST SIDE		   ]")
	print("---------------------------------------")
	term.setCursorPos(1,3)
	print("1-Up")
	term.setCursorPos(1,4)
	print("2-Right")
	term.setCursorPos(1,5)
	print("3-Bottom")
	term.setCursorPos(1,6)
	print("4-Left")
	term.setCursorPos(1,7)
	print("5-Back")
	term.setCursorPos(1,11)
	print("Type the number and press enter")
	term.setCursorPos(1,12)
	print("---------------------------------------")
	term.setCursorPos(1,13)
	ichestside = (io.read() * 1)
until (ichestside == 1 or ichestside == 2 or ichestside == 3 or ichestside == 4 or ichestside == 5) == true and fchestside ~= ichestside
save()
repeat
	term.clear()
	term.setCursorPos(1,1)
	print("[			SLEEPING TIME			]")
	print("---------------------------------------")
	print("Hours between harvests? Can be a decimal number using a dot.")
	print("")
	print("i.e 0.5 -> 30 minutes")
	term.setCursorPos(1,13)
	delay = (io.read() * 1)
until delay >= 0
runlevel = 1
end
function wait()
	if remaining <= 0 and step == 2 then remaining = (delay*3600) end
	repeat
		remaining = remaining - 1
		sleep(1)
	until remaining <= 0
end
function redstone()
	os.pullEvent("redstone")
	term.clear()
end
save()
if step == 1 then gui() end
while true do
	if step == 1 then
		titems = 0
		if distance == 0 then setup(1000) else setup(distance) distance = 0 end
		if mfmode == 1 then
			while turtle.detectDown() == false do
				down()
			end
			main()
			while turtle.detectUp() == false do
				while turtle.detect() == false do
					up()
				end
				repeat
					up()
				until turtle.detect() == false
				main()
			end
			go(0, 0, 0, 1)
		else main() end
		repeat
			slot = (slot + 1)
			ls[slot] = turtle.getItemCount(slot)
		until slot == 16
		setup(0)
		save()
		step = 2
		save()
	else
	parallel.waitForAny(wait, redstone, gui)
	term.clear()
	step = 1
	save()
	end
end
[font=tahoma, geneva, sans-serif][size=5]

Edited on 04 October 2014 - 09:13 AM
Isitar #2
Posted 24 January 2014 - 12:03 PM
looks cool, looking forward trying it out !
menellinde #3
Posted 14 February 2014 - 06:27 PM
The turtle is randomly skipping blocks when it replants. My farm area is 11 X 12 and the turtle will pick up every crop inside the area, but it skips replanting on one and sometimes two blocks here and there, and not always the same blocks.
Kotawolf #4
Posted 16 February 2014 - 05:21 PM
On problem…. does not return home when inventory is full…. will dump the extras.
Testing it with Magic Crops, seems to work very well.
Mendoza #5
Posted 18 February 2014 - 03:00 PM
The turtle is randomly skipping blocks when it replants. My farm area is 11 X 12 and the turtle will pick up every crop inside the area, but it skips replanting on one and sometimes two blocks here and there, and not always the same blocks.

Yes, the turtle randomly wont put some blocks, is an internal error that i cant explain
Mendoza #6
Posted 18 February 2014 - 03:12 PM
On problem…. does not return home when inventory is full…. will dump the extras.
Testing it with Magic Crops, seems to work very well.

The turtle wont return home anyway, so you have to put less crops to prevent that, but i will repair it (in V2)
Edited on 18 February 2014 - 02:17 PM
Kotawolf #7
Posted 18 February 2014 - 04:39 PM
On problem…. does not return home when inventory is full…. will dump the extras.
Testing it with Magic Crops, seems to work very well.

The turtle wont return home anyway, so you have to put less crops to prevent that, but i will repair it (in V2)

Cool that works. Thanks
menellinde #8
Posted 18 February 2014 - 09:00 PM
could you maybe set it to place seeds if it detects nothing rather than skipping over the empty blocks? At least that way it will fix its mistakes somewhat. Otherwise overtime the amount of planted wheat gets smaller and smaller since it doesn't pay attention to empty blocks, and it is also skipping planting on some.
Mendoza #9
Posted 19 February 2014 - 08:25 AM
could you maybe set it to place seeds if it detects nothing rather than skipping over the empty blocks? At least that way it will fix its mistakes somewhat. Otherwise overtime the amount of planted wheat gets smaller and smaller since it doesn't pay attention to empty blocks, and it is also skipping planting on some.

The reason why the turtle not put the item is because the wheat can drop 0 seeds (The turtle wont plant nothing) This will be fixed in V2. And yes, the turtle will skip the empty blocks, for example water or lava, but this is not a bug

Thanks for report that bug
Edited on 19 February 2014 - 07:26 AM
nine300 #10
Posted 19 March 2014 - 05:40 AM
on the server i have been going on the server keeps restarting and then asking me to type a number however i cant type that number when i'm offline so i was wondering if you could make a version which harvests hourly instead of asking how many hours please
Mendoza #11
Posted 22 March 2014 - 01:58 PM
on the server i have been going on the server keeps restarting and then asking me to type a number however i cant type that number when i'm offline so i was wondering if you could make a version which harvests hourly instead of asking how many hours please

I´m working on V2, that won´t delete the data on every start, so you haven´t to do that, only the 1º time.
Thanks for report that
Sam_Starfall #12
Posted 17 April 2014 - 07:02 PM
you could even ask the time to harvest as an [arg] to start the program that way you could have the shell.run("farm",2) as the start up for the turtle.
DielsAlder #13
Posted 30 April 2014 - 06:27 AM
i cant get the turtles to harvest every 42 minutes. i download the program, run it, type in ".7" when it prompts for interval between harvests. they run once and thats it. i have no idea what im doing wrong

edit: i think the issue was that i didnt name the turtle. oddly enough, even though i didnt name the turtle, when the program stopped i could still manually control via redstone signals, but they wouldnt farm on an internval and i couldnt interact with them outside of redstone signal


is there a way to stop them midfarm?
Edited on 30 April 2014 - 09:46 AM
Mendoza #14
Posted 03 May 2014 - 02:03 PM
i cant get the turtles to harvest every 42 minutes. i download the program, run it, type in ".7" when it prompts for interval between harvests. they run once and thats it. i have no idea what im doing wrong

edit: i think the issue was that i didnt name the turtle. oddly enough, even though i didnt name the turtle, when the program stopped i could still manually control via redstone signals, but they wouldnt farm on an internval and i couldnt interact with them outside of redstone signal


is there a way to stop them midfarm?

.7 is not a decimal number so type 0.7 :)/>

There isn´t a way to stop them midfarm ¿Why you want to do this?
Rexey #15
Posted 17 May 2014 - 03:02 PM
dont understand i write ucp(ultimate potato turtle xDD) named ur script that and i write 0.5 and enter and it just spins in a circle :S and breaks notting no farming please help me
apemanzilla #16
Posted 18 May 2014 - 04:43 PM
dont understand i write ucp(ultimate potato turtle xDD) named ur script that and i write 0.5 and enter and it just spins in a circle :S and breaks notting no farming please help me
Did you fuel it?
Rexey #17
Posted 18 May 2014 - 08:15 PM
dont understand i write ucp(ultimate potato turtle xDD) named ur script that and i write 0.5 and enter and it just spins in a circle :S and breaks notting no farming please help me
Did you fuel it?
have 900k fuel xD whats funny it breaks the block under it oO
Edited on 18 May 2014 - 06:15 PM
Rexey #18
Posted 18 May 2014 - 09:48 PM
need touturial xD i think :P/> how to set up the programm xd did not work but ill continue trying
Rexey #19
Posted 19 May 2014 - 02:24 AM
ok got it to work xd seems it needs coal even if i have enuf enegy,
But u shuld add a bonemeal option !
Mendoza #20
Posted 25 September 2014 - 12:03 PM
Post erased. (MFAS V1)
Edited on 25 September 2014 - 03:38 PM
Lyqyd #21
Posted 25 September 2014 - 03:29 PM
Threads merged. Feel free to update the first post and topic title.
Agoldfish #22
Posted 25 September 2014 - 05:22 PM
And you should put that code in a spoiler.
Clusterstorm21 #23
Posted 03 October 2014 - 08:45 AM
Hey :)/> When i type Start MFAS comes this error code: MFAS:120: "attempt to perform arithmetic __ add on nil and nil"

Can you help me ?

Sorry for that bad English :D/>
Mendoza #24
Posted 04 October 2014 - 10:49 AM
Thanks Clusterstorm, there was a bug, now it´s fixed

Download the MFAS again and try
Edited on 04 October 2014 - 09:16 AM
nlancaster #25
Posted 05 October 2014 - 08:08 AM
I think we need a bit more instructions and also I am having a bug.

Build the farm system as discribed AND plant your first crop.

The bug I am having, the turtle goes down the first row and back up the second row, and then right thru the item chest and on thru space.
Mendoza #26
Posted 06 October 2014 - 03:13 PM
nlancaster, I´ve tested the MFAS right now, 6th of October, with the farm of the picture and all is right. And, where do you need more instructions? For the program or for the build?
nlancaster #27
Posted 07 October 2014 - 06:10 AM
Ok instructions and lets address the bug I am seeing also:

1. your directions state to build it "any size" 2 blocks high. I did this, but my farm is about 35x10 in size.
2. your directions say nothing about planting the first crop.
3. when I run the program following the directions built in he just blows right thru the chest and wall after making the first turn. ie, he makes the first turn at one end. Then at the second turn for the 3rd row he goes thru.

So something is bugged somewhere. I will try building one exactly like you show.
Mendoza #28
Posted 07 October 2014 - 05:41 PM
Your build is normal or with minimal blocks?

And I think that the MFAS is not bugged, because noone had this issue
LDDestroier #29
Posted 07 October 2014 - 05:51 PM
Could you post a fast-forward video of an uninterupted farming turtle with the program that harvests and replants a huge 3-layer farm 4 times in a row?
Mendoza #30
Posted 11 October 2014 - 03:05 PM
Why you want a video like that?
RepeaterCreeper #31
Posted 12 October 2014 - 07:30 PM
It keeps giving out the error when it's done doing 1 cycle.

startup:43: Slot number 17 out of range

EDIT: It was actually because inventory was full. It kept seperating 3 sugar canes into 3 different slots. Also I would like to suggest to use turtle.suckDown because three high sugar canes are basically useless if the top one just falls off. But yeah it would be great if you were to empty the turtle inventory before going to next layer.

EDIT2: Or maybe it's not… it just happened again.
Edited on 12 October 2014 - 07:20 PM
Dwayne Dibbley #32
Posted 03 November 2014 - 12:52 PM
It keeps giving out the error when it's done doing 1 cycle.

startup:43: Slot number 17 out of range

EDIT: It was actually because inventory was full. It kept seperating 3 sugar canes into 3 different slots. Also I would like to suggest to use turtle.suckDown because three high sugar canes are basically useless if the top one just falls off. But yeah it would be great if you were to empty the turtle inventory before going to next layer.

EDIT2: Or maybe it's not… it just happened again.

i fudged it by adding slot = 0 after line 40 :-


h.close()
ls = {}
slot = 0
repeat
	    slot = (slot + 1)
			    ls[slot] = turtle.getItemCount(slot)
until slot == 16
function save()

seems to be reading slot = 16 from the VALUES file, so the repeat loop tries to select slot 17 on the first pass. Not sure what to slot value is used for on first load?

Thanks
ailmanki #33
Posted 14 December 2014 - 02:37 AM
Nice script, would it be possible that when the turtle picks up half slabs , that it puts em back correctly?
I have the water holes covered with half slabs, and now it picks em up, and puts em back down in wrong position.
Well even better would be if it wouldn't pick em up at all I guess. Maybe some blacklist or something, for stuff it shouldn't pick up.
General6356 #34
Posted 27 December 2014 - 06:32 PM
Turtle will not pick up seeds - if I put them in its inventory it just drops them back in the item chest and then runs…..cant figure out how to fix
ailmanki #35
Posted 27 December 2014 - 11:33 PM
You plant the seeds first, it will only harvest the ones you planted, and plant em again (if possible)
Kotawolf #36
Posted 01 March 2015 - 09:15 PM
Request:

IF it is easy to accomplish:

In the menu, is there a way to do a check until next run?
Or to simply display the time to next run in some way.

Please consider this as a … It would be nice to have request.
civilwargeeky #37
Posted 02 March 2015 - 02:35 AM
Request:

IF it is easy to accomplish:

In the menu, is there a way to do a check until next run?
Or to simply display the time to next run in some way.

Please consider this as a … It would be nice to have request.
Hi! I saw your post and figured it would be easy so I implemented it for you :)/>

Here is the script with changes to make it display time to next run. http://pastebin.com/x01V3drP
Disclaimer: I claim no ownership over this code, I just edited a couple of lines.
MrGiek #38
Posted 22 April 2015 - 02:56 PM
I have a little problem the turlte on the last line will go on loop on the last line and in wont come back to the start T,T
SpitfireFOOL80 #39
Posted 16 September 2015 - 04:35 PM
I have a little problem the turlte on the last line will go on loop on the last line and in wont come back to the start T,T

You need to make sure to keep 1 block of the wall type you made in slot 16. I about gave up on this farm but it is working amazingly.
Creator #40
Posted 04 November 2015 - 09:26 PM
Is this code on GitHub, because I really want to improve it and give you some nice coding tips.
Edited on 04 November 2015 - 08:26 PM
DeathNET #41
Posted 27 November 2015 - 09:30 AM
okay i saw someone else mention this but i didnt see any response to it or even a way of how to fix it, but on the second row it goes right through the item chest?
jgilmore #42
Posted 05 December 2016 - 04:59 AM
FTFY.

Now on github at https://github.com/jgilmore/MFAS

Also pastebin
pastebin get KqR95e8A MFAS
MAKE SURE TO LABEL YOUR TURTLE. Really, saves a ton of time: label set "MFAS"
Almost a complete rewrite,
Partial list of new features:
Goes around fluids (waterfall in multi-level farm)
Chests are also considered walls
Replants even if it didn't harvest (configurable)
No longer prompts for fuel chest location if turtle fuel is unlimited
No longer harvests the base of the reeds
Mod specific crop harvesting is now easier to add later
No longer digs up base minecraft non-crop items (half slabs over your water source, anyone?)
Command line options are now supported (menu,reset,RESET)
Now creates a "startup" file so is automatically restarted when you replace it, or reload the world.
Maybe more, I forget.

Known bugs:
Doesn't handle wide water columns gracefully. At all.
Doesn't handle magical crops (probably, untested)
Doesn't handle other mods unless specifically told to (but easy to add them)
Doesn't automatically generate a label for your turtle if you didn't already label it. (It probably should)
Requires dirt or farmland at the edge for multi-floor farms (zivico farmland etc not supported, yet)

Probably many more bugs to.