Skip to content

Instantly share code, notes, and snippets.

@bortels
Created February 18, 2013 00:18
Show Gist options
  • Save bortels/4974340 to your computer and use it in GitHub Desktop.
Save bortels/4974340 to your computer and use it in GitHub Desktop.
Startup Script for Computercraft Turtles
-- startup script for melee turtle
-- grabs a fresh copy of melee script on startup, then executes it
-- install with "pastebin get YBWf4qsN startup"
pastebinid = "UYwardhQ"
payload = "melee"
backup = payload .. ".bak"
print("Fetching " .. payload .. " program from pastebin")
if (fs.exists(backup)) then
fs.delete(backup)
end
fs.move(payload, backup)
ok = shell.run("pastebin", "get " .. pastebinid .. " " .. payload)
print("pastebin results: " .. ok)
print("Executing " .. payload .. " program")
if (not fs.exists(payload)) then
print("Error: '" .. payload .. "' does not exist. Using old version.")
fs.copy(backup, payload)
end
shell.run(payload)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment