Advertisement
karelvysinka

Turtle crafting system client program 2019

Dec 29th, 2018
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local version =
  2. 1.0
  3. --Czech title:
  4. -- Pri zmene programu je treba na radku 2 zmenit verzi, aby se program automaticky aktualizoval
  5. -- local code je treba zmenit dle potreby
  6. --(c) ScherryCZ - Author contact: scherry@email.cz
  7.  
  8. ------------------------------------------------------------------------------------------------
  9. -- UPDATE system
  10. ------------------------------------------------------------------------------------------------
  11. local code = "jq2VhdV6"
  12.  
  13. --check version
  14. term.clear()
  15. term.setCursorPos(1,1)
  16. print("Program loading...")
  17. print("Current version: "..version)
  18. local updateSite= http.get("http://pastebin.com/raw.php?i="..code)
  19. updateSite.readLine()
  20. local newVersion = updateSite.readLine()
  21. if tonumber(newVersion) > version then
  22.         print("Update required. Updating now...")
  23.         local updateSite = http.get("http://pastebin.com/raw.php?i="..code)
  24.         local siteFile = updateSite.readAll()
  25.         local writeFile = fs.open(shell.getRunningProgram(),"w")
  26.         writeFile.write(siteFile)
  27.         writeFile.close()
  28.         print("The program will now restart your computer.")
  29.         sleep(1)
  30.         os.reboot()
  31. end
  32.  
  33. ------------------------------------------------------------------------------------------------
  34. -- START PROGRAM
  35. ------------------------------------------------------------------------------------------------
  36. print("Working")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement