Advertisement
HPWebcamAble

Message System 2 Installer

Dec 15th, 2013
617
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.96 KB | None | 0 0
  1. local vers = "2.0"
  2.  
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. --This is a function is part of Pastebin! I didn't write this--
  7. --Well, I rewrote it to be used inside of a program rather than as a program itself--
  8. function get(sCode,sFile)
  9.     local sPath = shell.resolve( sFile )
  10.     if fs.exists( sPath ) then
  11.         return false
  12.     end
  13.     local response = http.get("http://pastebin.com/raw.php?i="..textutils.urlEncode( sCode ))
  14.     if response then       
  15.         local sResponse = response.readAll()
  16.         response.close()       
  17.         local file = fs.open( sPath, "w" )
  18.         file.write( sResponse )
  19.         file.close()
  20.         return true    
  21.     else
  22.         return false
  23.     end
  24. end
  25.  
  26. --Program--
  27. if not http then
  28.     error("Http API not enabled")
  29. end
  30. if not term.isColor() then
  31.   print("NOTE: Message System 2 is designed for advanced computers. It will not run on regular computers")
  32.   print(" ")
  33. end
  34. print("Messagesystem Installer v"..vers.." is ready!")
  35. print("Press any key to continue...")
  36. os.pullEvent("key")
  37. print("Downloading MessageSystem...")
  38. if fs.exists("ms2") then
  39.   print("File conflict! Deleting...")
  40.   shell.run("delete ms2")
  41.   print("Fixed. Retrying...")
  42. end
  43. if get("npEnj7XD","ms2") then
  44.   print("Message System 2 successfully downloaded")
  45. else
  46.   print("Something went wrong while downloading :/")
  47.   return
  48. end
  49.  
  50. print("Downloading background...")
  51. if fs.exists("msbg") then
  52.   print("File conflict! Deleting...")
  53.   shell.run("delete msbg")
  54.   print("Fixed. Retrying...")
  55. end
  56. if get("79HdkjG7","msbg") then
  57.   print("Background successfully downloaded")
  58. else
  59.   print("Something went wrong while downloading :/")
  60.   return
  61. end
  62.  
  63. print("Install Completed")
  64. print("Run Message System 2 now?")
  65. print("y/n")
  66. local event,par1
  67. local run = false
  68. while true do
  69.   event,par1 = os.pullEvent("char")
  70.   if par1 == "y" then
  71.     print("Running...")
  72.     run = true
  73.     break
  74.   elseif par1 == "n" then
  75.     print("Thank you for using Message System :)")
  76.     break    
  77.   end
  78. end
  79.  
  80. if run then
  81.   shell.run("ms2")
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement