Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Initialize turtle with standard programs.
- -- This script pulls all 'usual' turtle programs from Pastebin to set up a default turtle
- -- or update existing programs on older turtles.
- -- Table of programs and their Pastebin codes, organized alphabetically
- local programs = {
- ["anvildrop.lua"] = "mcrhqDy0",
- ["borethrough.lua"] = "NcPPMjSp",
- ["boxmining.lua"] = "9LGhh30Y",
- ["clayminer.lua"] = "6mKBdMvD",
- ["downramp.lua"] = "M5w7bYQ1",
- ["floor.lua"] = "BmpxvsU0",
- ["initupdate.lua"] = "ZDcrJian",
- ["simp_tree.lua"] = "59cssnQ2",
- ["stairsUp.lua"] = "8cAJAG4D"
- }
- -- Function to update or download a program from Pastebin
- local function updateProgram(pastebinCode, programName)
- print("Starting update process for " .. programName .. "...")
- if fs.exists(programName) then
- print("Deleting old version of " .. programName .. "...")
- fs.delete(programName)
- if not fs.exists(programName) then
- print("Old version deleted successfully.")
- else
- error("Failed to delete old version of " .. programName)
- end
- else
- print("No old version of " .. programName .. " found.")
- end
- print("Downloading new version from Pastebin...")
- local success = shell.run("pastebin", "get", pastebinCode, programName)
- if success then
- print("Successfully downloaded " .. programName .. " from Pastebin.")
- print("Update complete! You can now run " .. programName .. ".")
- else
- error("Failed to download " .. programName .. " from Pastebin. Check the Pastebin code or internet connection.")
- end
- end
- -- Iterate through the programs table and update each program
- for programName, pastebinCode in pairs(programs) do
- updateProgram(pastebinCode, programName)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement