Advertisement
Ubidibity

init.lua

Apr 30th, 2025 (edited)
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.75 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.   ["stripmine.lua"] = "KftgQxmT"
  17. }
  18.  
  19. -- Function to update or download a program from Pastebin
  20. local function updateProgram(pastebinCode, programName)
  21.   print("Starting update process for " .. programName .. "...")
  22.   if fs.exists(programName) then
  23.     print("Deleting old version of " .. programName .. "...")
  24.     fs.delete(programName)
  25.     if not fs.exists(programName) then
  26.       print("Old version deleted successfully.")
  27.     else
  28.       error("Failed to delete old version of " .. programName)
  29.     end
  30.   else
  31.     print("No old version of " .. programName .. " found.")
  32.   end
  33.  
  34.   print("Downloading new version from Pastebin...")
  35.   local success = shell.run("pastebin", "get", pastebinCode, programName)
  36.   if success then
  37.     print("Successfully downloaded " .. programName .. " from Pastebin.")
  38.     print("Update complete! You can now run " .. programName .. ".")
  39.   else
  40.     error("Failed to download " .. programName .. " from Pastebin. Check the Pastebin code or internet connection.")
  41.   end
  42. end
  43.  
  44. -- Iterate through the programs table and update each program
  45. for programName, pastebinCode in pairs(programs) do
  46.   updateProgram(pastebinCode, programName)
  47. end
  48.  
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement