Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- AE2 Stockpile Manager - Setup Helper
- -- v1
- -- Helps configure auto-start and validates installation
- local function checkFile(filename)
- if fs.exists(filename) then
- return true
- else
- return false
- end
- end
- local function showHeader()
- term.clear()
- term.setCursorPos(1, 1)
- print("=== AE2 Stockpile Setup ===")
- print()
- end
- local function checkInstallation()
- showHeader()
- print("Checking installation...")
- print()
- local files = {
- "ae2_main.lua",
- "ae2_config.lua",
- "ae2_display.lua",
- "ae2_interface.lua",
- "ae2_menu.lua"
- }
- local allPresent = true
- for _, file in pairs(files) do
- if checkFile(file) then
- print("[OK] " .. file)
- else
- print("[MISSING] " .. file)
- allPresent = false
- end
- end
- print()
- if allPresent then
- print("Installation complete! All files found.")
- return true
- else
- print("Installation incomplete. Please download missing files.")
- return false
- end
- end
- local function configureAutoStart()
- showHeader()
- print("Auto-Start Configuration")
- print()
- if checkFile("startup.lua") then
- print("startup.lua already exists.")
- write("Overwrite existing startup.lua? (y/n): ")
- local confirm = read()
- if confirm:lower() ~= "y" then
- return
- end
- end
- print("Setting up auto-start...")
- -- Copy startup script content (simplified for this example)
- local startupContent = [[-- AE2 Stockpile Auto-Start
- term.clear()
- term.setCursorPos(1, 1)
- print("=== AE2 Stockpile Auto-Start ===")
- print("Starting in 3 seconds... (Ctrl+T to cancel)")
- os.sleep(3)
- shell.run("ae2_main.lua", "auto")
- ]]
- local file = fs.open("startup.lua", "w")
- if file then
- file.write(startupContent)
- file.close()
- print("Auto-start configured successfully!")
- print()
- print("The AE2 Stockpile Manager will now start automatically")
- print("when this computer boots up.")
- else
- print("ERROR: Could not create startup.lua")
- end
- end
- local function disableAutoStart()
- if checkFile("startup.lua") then
- fs.delete("startup.lua")
- print("Auto-start disabled. startup.lua removed.")
- else
- print("Auto-start is not currently enabled.")
- end
- end
- local function showMainMenu()
- showHeader()
- print("1. Check Installation")
- print("2. Enable Auto-Start")
- print("3. Disable Auto-Start")
- print("4. Run AE2 Stockpile Manager")
- print("5. Run AE2 Stockpile Manager (Auto Mode)")
- print("6. Exit Setup")
- print()
- write("Select option: ")
- return read()
- end
- local function main()
- while true do
- local choice = showMainMenu()
- if choice == "1" then
- checkInstallation()
- print()
- print("Press any key to continue...")
- os.pullEvent("key")
- elseif choice == "2" then
- if checkInstallation() then
- print()
- print("Press any key to continue...")
- os.pullEvent("key")
- configureAutoStart()
- print()
- print("Press any key to continue...")
- os.pullEvent("key")
- else
- print()
- print("Please install all required files first.")
- print("Press any key to continue...")
- os.pullEvent("key")
- end
- elseif choice == "3" then
- disableAutoStart()
- print()
- print("Press any key to continue...")
- os.pullEvent("key")
- elseif choice == "4" then
- if checkFile("ae2_main.lua") then
- shell.run("ae2_main.lua")
- else
- print("ae2_main.lua not found!")
- os.sleep(2)
- end
- elseif choice == "5" then
- if checkFile("ae2_main.lua") then
- shell.run("ae2_main.lua", "auto")
- else
- print("ae2_main.lua not found!")
- os.sleep(2)
- end
- elseif choice == "6" then
- break
- end
- end
- showHeader()
- print("Setup complete!")
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment