Advertisement
honeyphos1234

Computercraft updater

Jul 6th, 2015
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.51 KB | None | 0 0
  1. program = { -- program name here
  2. [1] = "program1",
  3. [2] = "program2"
  4. }
  5. paste = { --pastebin code here
  6. [1] = "code1",
  7. [2] = "code2"
  8. }
  9. update = 1
  10. --1 = true
  11. --0 = false
  12.  
  13. runProg = "..." --put the name of the program u want to run here
  14.  
  15. if not #program == #paste then
  16.   if #program > #paste then
  17.     error("not enough pastebin codes")
  18.   else
  19.     error("more pastebin codes than program names")
  20.   end
  21. end
  22. for x = 1, #programs do
  23.  if update == 1 or update = false then
  24.   term.setCursorPos(1,1)
  25.   term.setTextColor(colors.white)
  26.   term.write("Update mode is set to ")
  27.   term.setTextColor(colors.lime)
  28.   term.write("Enabled")
  29.   term.setCursorPos(1,2)
  30.   term.setTextColor(colors.blue)
  31.   print("Updating "..program[x].." ...")
  32.   sleep(.5)
  33.   print(" ")
  34.   term.setTextColor(colors.red)
  35.   print("Deleting "..program[x])
  36.   shell.run('delete'..program[x])
  37.   print(" ")
  38.   term.setTextColor(colors.lime)
  39.   print("getting "..paste[x].." as "..program[x])
  40.   shell.run('pastebin get '..paste[x]..' '..program[x])
  41.   sleep(.5)
  42. else
  43.   term.setCursorPos(1,1)
  44.   term.setTextColor(colors.white)
  45.   term.write("Update mode is ")
  46.   term.setTextColor(colors.red)
  47.   term.write(" Disabled")
  48.   sleep(1)
  49.   term.setCursorPos(1,2)
  50.   term.setTextColor(colors.lightBlue)
  51.   print("update will not commence")
  52.   print("edit the program and change update to 1")
  53.   print("if you would like to change this")
  54.   print(" ")
  55.   sleep(2)
  56.   print("starting up "..program[x])
  57.   sleep(.5)
  58.   shell.run(program[x])
  59.  end
  60. end
  61.  
  62. shell.run(runProg)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement