SHOW:
|
|
- or go back to the newest paste.
| 1 | - | local update_name = "updateV5" |
| 1 | + | if fs.exists("AndysPrograms/api/update") == false then
|
| 2 | fs.makeDir("AndysPrograms/api")
| |
| 3 | shell.run("cd","AndysPrograms/api")
| |
| 4 | shell.run("pastebin","get","1niw24Vd","update")
| |
| 5 | - | local gui_url = "0UkEdCjY" |
| 5 | + | |
| 6 | - | local farm_url = "ZW6q8wWs" |
| 6 | + | |
| 7 | - | local goto_url = "a3GBewNp" |
| 7 | + | |
| 8 | - | if fs.exists("AndysPrograms/api"..update_name) == false then
|
| 8 | + | launcherargs = {...}
|
| 9 | fudargs = "sleep(5)\nshell.run(\"farm\", \"noset\")" | |
| 10 | --print (fudargs) | |
| 11 | - | shell.run("pastebin","get","uBa2UnVT",update_name)
|
| 11 | + | |
| 12 | farmlauncherloop = 1 | |
| 13 | local stopfarm = 0 | |
| 14 | errhnd = 0 | |
| 15 | - | shell.run("AndysPrograms/api/"..update_name, "gui", gui_url, "AndysPrograms/api/gui", "none", "none")
|
| 15 | + | function cllfrm() |
| 16 | - | if fs.exists("AndysPrograms/api/pastebin_silent/ps") == false then
|
| 16 | + | |
| 17 | - | fs.makeDir("AndysPrograms/api/pastebin_silent")
|
| 17 | + | |
| 18 | - | shell.run("cd","AndysPrograms/api/pastebin_silent")
|
| 18 | + | |
| 19 | - | shell.run("pastebin","get","Zp2CC5qM","ps")
|
| 19 | + | |
| 20 | if err == "Terminated" then | |
| 21 | stopfarm = 1 | |
| 22 | else | |
| 23 | term.setCursorPos(1, 1) | |
| 24 | term.clear() | |
| 25 | - | launcherargs = {...}
|
| 25 | + | print("Error, Rebooting...")
|
| 26 | - | local farm_prog_progress = "init" |
| 26 | + | term.setCursorPos(1, 3) |
| 27 | - | while loadedguilib ~= 1 do |
| 27 | + | print( "Error:",err) |
| 28 | - | if os.loadAPI("AndysPrograms/api/gui/gui") then
|
| 28 | + | term.setCursorPos(1, 4) |
| 29 | - | --print("loaded gui lib")
|
| 29 | + | errhnd = 1 |
| 30 | - | loadedguilib = 1 |
| 30 | + | sleep(2) |
| 31 | end | |
| 32 | - | print(" NOTloaded gui lib")
|
| 32 | + | |
| 33 | ||
| 34 | local function ud() | |
| 35 | shell.run("AndysPrograms/api/update", "gt", "a3GBewNp", "AndysPrograms/api", "none", "none")
| |
| 36 | - | function get_running() |
| 36 | + | shell.run("AndysPrograms/api/update", "farm", "ZW6q8wWs", "AndysPrograms/farm", "none", "no", unpack(launcherargs))
|
| 37 | - | return andy_farm_program_running |
| 37 | + | |
| 38 | ud() | |
| 39 | - | function set_running(n) |
| 39 | + | |
| 40 | - | andy_farm_program_running = n |
| 40 | + | while true do |
| 41 | if stopfarm == 0 then | |
| 42 | local stu = fs.open("startup.lua", "w")
| |
| 43 | stu.write(fudargs) | |
| 44 | stu.close() | |
| 45 | if errhnd == 0 then | |
| 46 | ||
| 47 | end | |
| 48 | - | stopfarm = 0 |
| 48 | + | os.loadAPI("AndysPrograms/farm/farm")
|
| 49 | if farmlauncherloop > 1 then | |
| 50 | - | function call_farm() |
| 50 | + | launcherargs = {"noset"}
|
| 51 | end | |
| 52 | ||
| 53 | - | function running_check() |
| 53 | + | if xpcall(cllfrm,errhndlr) then |
| 54 | - | while _G.andy_farm_program_running == 1 do |
| 54 | + | ud() |
| 55 | - | sleep(0.03) |
| 55 | + | |
| 56 | sleep(2) | |
| 57 | errhnd = 0 | |
| 58 | - | function para_farm() |
| 58 | + | ud() |
| 59 | - | parallel.waitForAny(call_farm,running_check) |
| 59 | + | |
| 60 | ||
| 61 | ||
| 62 | if errhnd ~= 0 then | |
| 63 | sleep(2) | |
| 64 | errhnd = 0 | |
| 65 | end | |
| 66 | - | local dot = 0 |
| 66 | + | sleep(0) |
| 67 | - | -- term.setCursorPos(1, 1) |
| 67 | + | if farmlauncherloop < 100 then |
| 68 | - | -- term.clear() |
| 68 | + | farmlauncherloop = farmlauncherloop + 1 |
| 69 | - | -- print("Error, Retrying"..dot)
|
| 69 | + | |
| 70 | - | -- term.setCursorPos(1, 3) |
| 70 | + | |
| 71 | - | -- print( "Error:",err) |
| 71 | + | break |
| 72 | - | -- term.setCursorPos(1, 4) |
| 72 | + | |
| 73 | - | -- errhnd = 1 |
| 73 | + |