Advertisement
Ubidibity

init.lua

Apr 30th, 2025 (edited)
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.71 KB | Gaming | 0 0
  1. -- Initialize turtle with standard programs.
  2. -- This script pulls all 'usual' turtle programs from Pastebin to set up a default turtle
  3. -- or update existing programs on older turtles.
  4.  
  5. -- Table of programs and their Pastebin codes, organized alphabetically
  6. local programs = {
  7.   ["anvildrop.lua"] = "mcrhqDy0",
  8.   ["borethrough.lua"] = "NcPPMjSp",
  9.   ["boxmining.lua"] = "9LGhh30Y",
  10.   ["clayminer.lua"] = "6mKBdMvD",
  11.   ["downramp.lua"] = "M5w7bYQ1",
  12.   ["floor.lua"] = "BmpxvsU0",
  13.   ["initupdate.lua"] = "ZDcrJian",
  14.   ["simp_tree.lua"] = "59cssnQ2",
  15.   ["stairsUp.lua"] = "8cAJAG4D"
  16. }
  17.  
  18. -- Function to update or download a program from Pastebin
  19. local function updateProgram(pastebinCode, programName)
  20.   print("Starting update process for " .. programName .. "...")
  21.   if fs.exists(programName) then
  22.     print("Deleting old version of " .. programName .. "...")
  23.     fs.delete(programName)
  24.     if not fs.exists(programName) then
  25.       print("Old version deleted successfully.")
  26.     else
  27.       error("Failed to delete old version of " .. programName)
  28.     end
  29.   else
  30.     print("No old version of " .. programName .. " found.")
  31.   end
  32.  
  33.   print("Downloading new version from Pastebin...")
  34.   local success = shell.run("pastebin", "get", pastebinCode, programName)
  35.   if success then
  36.     print("Successfully downloaded " .. programName .. " from Pastebin.")
  37.     print("Update complete! You can now run " .. programName .. ".")
  38.   else
  39.     error("Failed to download " .. programName .. " from Pastebin. Check the Pastebin code or internet connection.")
  40.   end
  41. end
  42.  
  43. -- Iterate through the programs table and update each program
  44. for programName, pastebinCode in pairs(programs) do
  45.   updateProgram(pastebinCode, programName)
  46. end
  47.  
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement