Hey, I'm currently writing a turtle butler program. It's not quite all the way done just yet...
So far it automatically farms and 5 x 5 x 3 (in a straight line) You have write the program of where to go, unless you just want to follow EXACTLY how to set the turtle up...It's still in Alpha. So far, it asks what you want it to do, there are extra lines that describe what functions there are. There are only two FULL operations for it to do, Tool, and Farm. when you do Tool you only have the option for either Pickaxe or Axe. Then after you choose those, it will ask what kind of material. Wood - Diamond. Any modded materials you'll have to add yourself, but the crafting would all be the same, so you would just need to make it move to the extra pickup station...There's quite a bit in this program, so I'll have to get pictures later today, I'll try to get those and then edit them into here if I can. Not uploaded anywhere just yet, I'l insert the current code into here for right now though.
The startup spoiler is for the "Login" at the startup of the turtle, after you enter the current Password, 3577, which I made the defualt (You can change it by doing Ctrl+T for a second then doing edit startup. It's a VERY short code so it shouldn't be very hard to find the four digit cooode to change it.)
term.clear()
term.setCursorPos(1,1)
write("Please Enter Password: ")
input = read("*")
while input ~= "3577" do
term.clear()
term.setCursorPos(1,1)
print("Incorrect Password...please try again!")
write("Please Enter Password: ")
input = read("*")
end
while true do
term.clear()
term.setCursorPos(1,1)
shell.run("Butler")
end
function returnCarrot()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.forward()
turtle.down()
turtle.down()
turtle.down()
turtle.turnRight()
for r = 1, 10 do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnLeft()
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.up()
turtle.up()
turtle.up()
end
depositItems()
end
function depositItems()
turtle.turnRight()
cleanInv()
for t = 1, 8, 1 do
turtle.select(t)
turtle.drop()
end
turtle.turnLeft()
end
function cleanInv()
turtle.select(13)
turtle.transferTo(5)
turtle.select(5)
turtle.transferTo(13,16)
turtle.select(14)
turtle.transferTo(6)
turtle.select(6)
turtle.transferTo(14,16)
turtle.select(15)
turtle.transferTo(7)
turtle.select(7)
turtle.transferTo(15,16)
turtle.select(16)
turtle.transferTo(8)
turtle.select(8)
turtle.transferTo(16,16)
turtle.select(1)
end
function turnAround()
while turtle.detect() do
turtle.turnRight()
end
end
function getOrders()
print("What do you need?: ")
print("[1] Tools")
print("[2] Farm")
print("[3] Main PC")
write("> ")
input = io.read()
if input == "1" then
do
term.clear()
term.setCursorPos(1,1)
whatTool()
end
end
if input == "2" then
do
term.clear()
term.setCursorPos(1,1)
whichField()
end
end
end
function whatTool()
term.clear()
term.setCursorPos(1,1)
print("What tool would you like for me to make you, Sir?:")
print("[1] Pickaxe")
print("[2] Axe")
print("[3] <--")
write("> ")
tool_input = io.read()
if tool_input == "3" then
do
term.clear()
term.setCursorPos(1,1)
getOrders()
end
end
if tool_input == "2" then
do
term.clear()
term.setCursorPos(1,1)
materialChoice()
craftAxe()
end
end
if tool_input == "1" then
do
term.clear()
term.setCursorPos(1,1)
materialChoice()
craftPick()
end
end
end
function matPick2()
turtle.turnLeft()
turtle.up()
turtle.select(2)
turtle.suck(2)
turtle.down()
turtle.turnRight()
turtle.select(1)
end
function matPick1()
turtle.turnRight()
turtle.select(1)
turtle.suck(3)
turtle.turnRight()
end
function materialChoice()
term.clear()
term.setCursorPos(1,1)
print("What material should I use?")
print("[1] Wood")
print("[2] Stone")
print("[3] Iron")
print("[4] Gold")
print("[5] Diamond")
print("[6] <--")
material_input = io.read()
if material_input == "6" then
do
term.clear()
term.setCursorPos(1,1)
whatTool()
end
end
if material_input == "4" then
do
term.clear()
term.setCursorPos(1,1)
print("Getting you a Gold Pickaxe, Sir...")
moveTo()
for m = 1, 9 do
turtle.forward()
end
matPick1()
for m = 1, 6 do
turtle.forward()
end
matPick2()
for m = 1, 3 do
turtle.forward()
end
moveBack()
end
end
if material_input == "5" then
do
term.clear()
term.setCursorPos(1,1)
moveTo()
for m = 1, 15 do
turtle.forward()
end
matPick1()
for m = 1, 12 do
turtle.forward()
end
matPick2()
for m = 1, 3 do
turtle.forward()
end
moveBack()
end
end
if material_input == "3" then
do
term.clear()
term.setCursorPos(1,1)
print("Getting you an Iron Pickaxe, Sir...")
moveTo()
for m = 1, 12 do
turtle.forward()
end
matPick1()
for m = 1, 9 do
turtle.forward()
end
matPick2()
for m = 1, 3 do
turtle.forward()
end
moveBack()
end
end
if material_input == "2" then
do
term.clear()
term.setCursorPos(1,1)
print("Getting you a Stone Pickaxe, Sir...")
moveTo()
for m = 1, 6 do
turtle.forward()
end
matPick1()
turtle.forward()
turtle.forward()
turtle.forward()
matPick2()
for m = 1, 3 do
turtle.forward()
end
moveBack()
end
end
if material_input == "1" then
do
term.clear()
term.setCursorPos(1,1)
print("Getting you a Wooden Pickaxe, Sir...")
moveTo()
for m = 1, 3 do
turtle.forward()
end
turtle.turnRight()
turtle.select(1)
turtle.suck(3)
turtle.select(2)
turtle.up()
turtle.suck(2)
turtle.down()
turtle.turnRight()
for m = 1, 3 do
turtle.forward()
end
moveBack()
end
end
end
function moveTo()
depositItems()
turtle.select(1)
while not turtle.detectDown() do
turtle.down()
end
if turtle.detect() then
turtle.turnRight()
turtle.turnRight()
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
end
function moveBack()
turtle.turnLeft()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnLeft()
end
while not turtle.detect() do
turtle.forward()
end
while turtle.detect() do
turtle.up()
end
end
function craftAxe()
turtle.select(12)
turtle.equipRight()
turtle.turnLeft()
turtle.select(1)
for d = 3, 16, 1 do
turtle.select(d)
turtle.drop()
end
turtle.turnRight()
turtle.select(2)
turtle.transferTo(6,1)
turtle.transferTo(10,1)
turtle.select(1)
turtle.transferTo(2,1)
turtle.transferTo(5,1)
turtle.craft()
turtle.turnLeft()
for g = 9, 15 do
turtle.select(g)
turtle.suck()
end
turtle.select(12)
turtle.equipRight()
turtle.turnRight()
turtle.select(1)
print("Axe complete!")
end
function craftPick()
turtle.select(12)
turtle.equipRight()
turtle.turnLeft()
turtle.select(1)
for d = 3, 16, 1 do
turtle.select(d)
turtle.drop()
end
turtle.turnRight()
turtle.select(2)
turtle.transferTo(6,1)
turtle.transferTo(10,1)
turtle.select(1)
turtle.transferTo(2,1)
turtle.transferTo(3,1)
turtle.craft()
turtle.select(12)
turtle.equipRight()
turtle.turnLeft()
for g = 9, 15 do
turtle.select(g)
turtle.suck()
end
turtle.turnRight()
turtle.select(1)
print("Pickaxe complete!")
end
function gotoFarm()
depositItems()
while not turtle.detectDown() do
turtle.down()
end
turtle.turnRight()
turtle.turnRight()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
while not turtle.detect() do
turtle.forward()
end
turtle.turnLeft()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnLeft()
turtle.up()
turtle.up()
turtle.up()
turtle.forward()
end
end
function approachSugarCane()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnLeft()
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
turtle.up()
end
function farmSugarCane()
turtle.select(9)
turtle.equipLeft()
turtle.select(11)
turtle.equipLeft()
turtle.select(1)
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.down()
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
for s = 1, 5 do
turtle.forward()
turtle.dig()
end
turtle.turnRight()
turtle.down()
request()
end
function whichField()
print("Which field?")
print("[1] Wheat")
print("[2] Carrots")
print("[3] Potatos")
print("[4] Pumpkins (WIP)")
print("[5] Melons (WIP)")
print("[6] SugarCane (WIP)")
print("[7] <--")
farm_input = io.read()
if farm_input == "7" then
do
term.clear()
term.setCursorPos(1,1)
getOrders()
end
end
if farm_input == "6" then
do
gotoFarm()
approachSugarCane()
farmSugarCane()
request()
end
end
if farm_input == "5" then
do
gotoFarm()
approachPumpkins()
FarmMelons()
request()
end
end
if farm_input == "4" then
do
gotoFarm()
approachMelons()
FarmMelons()
request()
end
end
if farm_input == "3" then
do
gotoFarm()
approachPotatos()
Farm()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()
Farm()
request()
end
end
if farm_input == "2" then
do
gotoFarm()
approachCarrots()
Farm()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()
Farm()
request()
end
end
if farm_input == "1" then
do
gotoFarm()
approachWheat()
Farm()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()
Farm()
request()
end
end
end
function request()
write("What next? Another field? Or back home?:")
request_input = io.read()
if request_input == "Return" then
do
local x, y, z = gps.locate(5)
if not x then
print("Failed to find location!")
else
print("I am at (" .. x .. ", " .. y .. ", " .. z .. ")")
end
end
end
if request_input == "Wheat" then
do
turtle.turnRight()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
do
turtle.turnRight()
end
end
turtle.select(9)
turtle.equipLeft()
turtle.select(15)
Farm()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnLeft()
Farm()
request()
end
end
end
function returnFarm()
turtle.forward()
turtle.down()
turtle.turnLeft()
while turtle.detectDown() do
turtle.forward()
end
if not turtle.detectDown() then
do
turtle.down()
turtle.down()
end
end
turtle.turnLeft()
turtle.turnLeft()
for r = 1, 10 do
turtle.forward()
end
turtle.turnRight()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
do
turtle.turnLeft()
end
end
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
do
turtle.up()
turtle.up()
turtle.up()
end
end
depositItems()
print("I'm Home!!!")
end
function approachPumpkins()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnLeft()
turtle.select(10)
turtle.equipLeft()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
turtle.digDown()
turtle.forward()
end
function approachPotatos()
turtle.turnRight()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
do
turtle.turnLeft()
turtle.turnLeft()
end
end
turtle.forward()
turtle.forward()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.select(9)
turtle.equipLeft()
turtle.select(13)
end
function approachCarrots()
turtle.turnLeft()
turtle.forward()
turtle.forward()
turtle.turnRight()
turtle.select(9)
turtle.equipLeft()
turtle.select(14)
end
function approachWheat()
turtle.turnLeft()
while not turtle.detect() do
turtle.forward()
end
if turtle.detect() then
turtle.turnRight()
end
turtle.select(9)
turtle.equipLeft()
turtle.select(15)
end
function Farm()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.turnRight()
turtle.forward()
turtle.turnRight()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
turtle.digDown()
turtle.placeDown()
turtle.forward()
end
turnAround()
getOrders()
Okay! That's all of the code! I'm having a bit of troubles on the Return function. It works PERFECTLY on the Wheat section, BUT on the Carrots, Pumpkins, Potatoes, Melons, and the Sugarcane, I don't want to have to type in MULTIPLE different return functions according to which field its it, I want to be able to just type in Return, and it finds its coordinates or something, and then according to which coodinates (field) it's at, it runs the specific function. Without me having to do a different option for EVERY FIELD! I know I'll still have to do the "Return" function for every field, but I don want to have to do something like ReturnWheat, ReturnCarrot, or ReturnPotato after each field...If you could help, that would be great! I already have it set so it finds it coordinates, now it's just to figure out how to get it to take those coordinates, and use them in a function... I'll be trying to get this going by myself, but it would be alot quicker to get this pushed out if I got help...thanks!
If you have a solution:
E-Mail:
[email protected]
Skype: danielboling1
Cell: (574)-312-8134 (Call or text, text would probably be best if you can...thanks.)
You can also put my phone number into something like AIM and text me that way if you don't have a phone.