Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local update_name = "updateV5"
- local gui_url = "0UkEdCjY"
- local farm_url = "ZW6q8wWs"
- local goto_url = "a3GBewNp"
- if fs.exists("AndysPrograms/api"..update_name) == false then
- fs.makeDir("AndysPrograms/api")
- shell.run("cd","AndysPrograms/api")
- shell.run("pastebin","get","uBa2UnVT",update_name)
- shell.run("cd","..")
- shell.run("cd","..")
- end
- shell.run("AndysPrograms/api/"..update_name, "gui", gui_url, "AndysPrograms/api/gui", "none", "none")
- if fs.exists("AndysPrograms/api/pastebin_silent/ps") == false then
- fs.makeDir("AndysPrograms/api/pastebin_silent")
- shell.run("cd","AndysPrograms/api/pastebin_silent")
- shell.run("pastebin","get","Zp2CC5qM","ps")
- shell.run("cd","..")
- shell.run("cd","..")
- shell.run("cd","..")
- end
- launcherargs = {...}
- local farm_prog_progress = "init"
- while loadedguilib ~= 1 do
- if os.loadAPI("AndysPrograms/api/gui/gui") then
- --print("loaded gui lib")
- loadedguilib = 1
- else
- print(" NOTloaded gui lib")
- end
- end
- function get_running()
- return andy_farm_program_running
- end
- function set_running(n)
- andy_farm_program_running = n
- end
- fudargs = "sleep(5)\nshell.run(\"farm\", \"noset\")"
- --print (fudargs)
- --sleep (5)
- farmlauncherloop = 1
- stopfarm = 0
- errhnd = 0
- function call_farm()
- farm.startfarm(launcherargs)
- end
- function running_check()
- while _G.andy_farm_program_running == 1 do
- sleep(0.03)
- end
- end
- function para_farm()
- parallel.waitForAny(call_farm,running_check)
- end
- function errhndlr(err)
- if err == "Terminated" then
- stopfarm = 1
- else
- local dot = 0
- -- term.setCursorPos(1, 1)
- -- term.clear()
- -- print("Error, Retrying"..dot)
- -- term.setCursorPos(1, 3)
- -- print( "Error:",err)
- -- term.setCursorPos(1, 4)
- -- errhnd = 1
- --sleep(2 / 3)
- sleep(0)
- end
- end
- local function ud()
- shell.run("AndysPrograms/api/"..update_name, "gt", goto_url, "AndysPrograms/api", "none", "none")
- shell.run("AndysPrograms/api/"..update_name, "farm", farm_url, "AndysPrograms/farm", "none", "no", unpack(launcherargs))
- end
- ud()
- function update_start_farm()
- loadedguilib = 0
- while loadedguilib ~= 1 do
- if os.loadAPI("AndysPrograms/api/gui/gui") then
- --print("loaded gui lib")
- loadedguilib = 1
- else
- print(" NOTloaded gui lib")
- end
- end
- farm_prog_progress = "not not even start"
- print(farm_prog_progress)
- while stopfarm == 0 do
- if _G.andy_farm_program_running == 0 then
- sleep(0)
- farm_prog_progress = "not even start"
- --print(farm_prog_progress)
- --print(get_running())
- -- while _G.init_gui ~= 1 do
- -- sleep(0.1)
- -- end
- end
- while _G.andy_farm_program_running == 1 do
- farm_prog_progress = "little even start"
- --print(farm_prog_progress)
- if stopfarm == 0 then
- farm_prog_progress = "little more start"
- --print(farm_prog_progress)
- local stu = fs.open("startup.lua", "w")
- stu.write(fudargs)
- stu.close()
- if errhnd == 0 then
- end
- os.loadAPI("AndysPrograms/farm/farm")
- if farmlauncherloop > 1 then
- launcherargs = {"noset"}
- end
- if xpcall(para_farm,errhndlr) then
- ud()
- else
- -- sleep(2)
- sleep(0)
- errhnd = 0
- ud()
- end
- if errhnd ~= 0 then
- sleep(0)
- errhnd = 0
- end
- sleep(0)
- if farmlauncherloop < 10000 then
- farmlauncherloop = farmlauncherloop + 1
- end
- else
- break
- end
- end
- end
- end
- local function farm_gui_lau()
- gui.start_farm_gui(launcherargs)
- end
- local function start_farm_lau()
- farm_prog_progress = "not not not(3) even start"
- --print(farm_prog_progress)
- update_start_farm()
- end
- local function start_para_lau()
- farm_prog_progress = "not not not not(4) even start"
- --print(farm_prog_progress)
- parallel.waitForAny(farm_gui_lau, start_farm_lau)
- end
- while stopfarm == 0 do
- --update_start_farm()
- _G.andy_farm_program_running = 0
- if launcherargs[1] == "noset" then
- _G.andy_farm_program_running = 1
- end
- start_para_lau()
- stopfarm = 1
- --parallel.waitForAny(farm_gui_lau, start_farm_lau)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement