Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- farmerturt v1.0 (Severino) [GNU GPL License, given here: <http://www.gnu.org/licenses/gpl.txt>]
- -- Some code based from Deluxe Turtle Farming Suite V1.0 Beta (alux35)
- -- http://www.computercraft.info/forums2/index.php?/topic/4639-deluxe-turtle-farming-suite/
- -----------------------------------------------------------------------
- shell.run("delete turtlename")
- term.clear()
- term.setCursorPos(1, 1)
- minerID = os.getComputerID()
- turtleName = nil
- consoleID = 0
- version = "1.0"
- function getConsoleID()
- local fname = "ConsoleID"
- if fs.exists(fname) then
- file = fs.open(fname, "r")
- consoleID = tonumber(file.readAll())
- file.close()
- print("Monitor Console ID: "..consoleID)
- else
- updateStatus("Waiting for Console ID...",true)
- term.write("Monitor Console ID: ")
- consoleID = io.read()
- file = fs.open(fname, "w")
- file.write(consoleID)
- file.close()
- consoleID = tonumber(consoleID)
- end
- end
- function updateStatus(msg, silent)
- if not rednet.isOpen("right") then rednet.open("right") end
- if rednet.isOpen("right") then
- if turtleName == nil then return end
- networkmsg = "MM:"..turtleName..": "..msg
- if consoleID == 0 then
- rednet.broadcast(networkmsg)
- else
- rednet.send(consoleID,networkmsg)
- end
- end
- if not silent then print(msg) end
- end
- function getTurtleName()
- local fname = "TurtleName"
- if fs.exists(fname) then
- file = fs.open(fname, "r")
- turtleName = file.readAll()
- file.close()
- else
- term.write("Turtle Name: ")
- turtleName = io.read()
- file = fs.open(fname, "w")
- file.write(turtleName)
- file.close()
- end
- end
- -- Main Program
- updateStatus("Starting")
- term.clear()
- term.setCursorPos(1,1)
- getTurtleName()
- getConsoleID()
- function update()
- print("Internet connection required...")
- print(" installing FarmerTurt files...")
- print(" press ENTER key to continue...")
- updateStatus("Waiting for User")
- io.read()
- shell.run("delete do_wheat")
- shell.run("pastebin get nvWd6fqD do_wheat")
- updateStatus("Updating do_wheat.")
- shell.run("delete do_wheatplant")
- shell.run("pastebin get UscYxzsZ do_wheatplant ")
- updateStatus("Updating do_wheatplant.")
- shell.run("delete do_sugar")
- shell.run("pastebin get TUx4PwVm do_sugar")
- updateStatus("Updating do_sugar.")
- shell.run("delete do_sugarplant")
- shell.run("pastebin get uRVizvya do_sugarplant")
- updateStatus("Updating do_sugarplant.")
- shell.run("delete do_veggies")
- shell.run("pastebin get tTxmq0nV do_veggies")
- updateStatus("Updating do_veggies.")
- shell.run("delete do_veggiesplant")
- shell.run("pastebin get uh2jDUG2 do_veggiesplant")
- updateStatus("Updating do_veggiesplant.")
- end
- function menu()
- updateStatus("Waiting at the Menu.")
- print("** Severino Farming Turtles Menu **")
- print("What type of farming would you like this turtle to perform?")
- print(" 1) Wheat (Harvest)")
- print(" 2) Wheat (Plant)")
- print(" 3) SugarCane (Harvest)")
- print(" 4) SugarCane (Plant)")
- print(" 5) Veggies (Harvest)")
- print(" 6) Veggies (Plant)")
- print(" 0) Automate")
- print(" 99) Exit")
- selection = io.read()
- if tonumber(selection) == 1 then
- print("you're choice was 1; running do_wheat")
- shell.run("do_wheat","")
- elseif tonumber(selection) == 2 then
- print("you're choice was 2; running do_wheatplant")
- shell.run("do_wheatplant","")
- elseif tonumber(selection) == 3 then
- print("you're choice was 3; running do_sugar")
- shell.run("do_sugar","")
- elseif tonumber(selection) == 4 then
- print("you're choice was 4; running do_sugarplant")
- shell.run("do_sugarplant","")
- elseif tonumber(selection) == 5 then
- print("you're choice was 5; running do_veggies")
- shell.run("do_veggies","")
- elseif tonumber(selection) == 6 then
- print("you're choice was 6; running do_veggiesplant")
- shell.run("do_veggiesplant","")
- elseif tonumber(selection) == 0 then
- print("Automation is still in development (press ENTER)")
- io.read()
- shell.run("clear","")
- menu()
- elseif tonumber(selection) == 99 then
- print("exiting...")
- shell.exit()
- end
- end
- update()
- print("PREREQUISITES: Fuel in last slot 16.")
- print("************************************")
- menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement