Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------
- --------------------------------------------
- -- Update script to grab latest code from --
- -- gitlab repo for turtle swarm. --
- -- save this as startup.lua on turtle --
- --------------------------------------------
- --------------------------------------------
- -- Functions
- function download(url, destinationFile)
- print("Downloading " .. destinationFile)
- local request = http.get(url)
- if request then
- local data = request.readAll()
- local file = fs.open(destinationFile, "w")
- file.write(data)
- file.close()
- request.close()
- else
- print("Could not download file")
- end
- end
- -- Delete old files that might update
- shell.run("rm drone")
- shell.run("rm turtle2")
- -- Make sure we have the static libs installed
- shell.run("pastebin get 4nRg9CHU json")
- -- Download the new files from gitlab
- download("https://git.blokegaming.com/bloke-gaming/public/turtle-swarm/-/raw/master/drone_code/drone.lua", "drone")
- download("https://git.blokegaming.com/bloke-gaming/public/turtle-swarm/-/raw/master/drone_code/turtle2.lua", "turtle2")
- -- Start the drone code
- print("Starting...")
- local result = shell.run("drone")
- if result then
- print("Done")
- else
- print("Error")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement