View difference between Paste ID: eUFSR2E9 and ZW6q8wWs
SHOW: | | - or go back to the newest paste.
1-
function startfarm(funfarmargs)
1+
updateloop = 0
2-
    while _G.andy_farm_program_running == 1 do
2+
udfarmargs = {...}
3-
        local setmenu = _G.setmenu
3+
if udfarmargs[1] == "noset" then
4-
        --print(table.concat(setmenu,", "))
4+
    udopenset = 0
5-
        --print(tostring(setmenu))
5+
end
6-
        version = "5"
6+
while true do
7-
        --term.clear()
7+
    if fs.exists("Farmnew") then
8-
        --term.setCursorPos(1, 1)
8+
        shell.run("delete","Farmnew") 
9-
        --print(version)
9+
10-
        done = 0
10+
    shell.run("pastebin","get","ZW6q8wWs","Farmnew")
11-
        local farm_prog_progress = "init"
11+
    if fs.exists("Farmnew") then
12-
        farm_prog_progress = 0
12+
        if fs.exists("Farmold") then
13-
        farm_prog_progress = farm_prog_progress + 1
13+
            shell.run("delete","Farmold")
14-
        farmapiloadedguilib = 0
14+
15-
        --term.clear()
15+
        if fs.exists("Farm") then
16-
        --term.setCursorPos(1, 1)                           
16+
            shell.run("rename","Farm","Farmold")
17-
        
17+
18-
        os.loadAPI("AndysPrograms/api/gt")  
18+
        shell.run("rename","Farmnew","Farm")
19-
        while farmapiloadedguilib ~= 1 do
19+
        if fs.exists("Farm") then
20-
            if os.loadAPI("AndysPrograms/api/gui/gui") then
20+
            break
21-
                --print("loaded gui farmapi lib")
21+
22-
                farmapiloadedguilib = 1
22+
23-
            else
23+
    if fs.exists("Farm") then
24-
                print(" NOTloaded gui lib")
24+
        if updateloop > 20 then
25
            break
26
        end
27-
27+
28-
        local setmenu = gui.get_setmenu()
28+
    if fs.exists("Farmold") then
29-
        --andy_farm_program_running = 0
29+
        if updateloop > 30 then
30-
30+
            shell.run("rename","Farmold","Farm")
31-
        if fs.exists("AndysPrograms/Farm/settings") then
31+
            if fs.exists("Farm") then
32-
            settings.load("AndysPrograms/Farm/settings")
32+
                break
33
            end
34-
        local maxW, maxH = term.getSize()
34+
35-
35+
36-
        farmexit = 0
36+
    updateloop = updateloop + 1
37-
        while farmexit ~= 1 do
37+
end
38-
38+
local stu = fs.open("startup.lua", "w")
39-
        local setmenu = _G.setmenu
39+
stu.write('sleep(5)\nshell.run("farmupdate", "noset")')
40-
40+
stu.close()
41-
41+
if udopenset == 0 then
42-
42+
    shell.run("Farm", "noset")
43-
43+
else
44-
        -- setmenu = {
44+
    shell.run("Farm")
45-
        --     {options = "Finish editing", handler = mainmenu_farm},
45+