Advertisement
Sparkybearbomb

Reactor Updater

Dec 20th, 2020 (edited)
1,262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. sleep(2)
  2.  
  3. if (fs.exists("newVersion.txt")) == true then
  4.     fs.delete("newVersion.txt")
  5. end
  6.  
  7. while (fs.exists("newVersion.txt")) == false do  
  8.     sleep(2)
  9.     shell.run("pastebin get KWdzfSbG newVersion.txt")
  10.     sleep(2)
  11.     local ver = fs.open("newVersion.txt", "r")
  12.     print(ver.readline())
  13.     newVersion = tonumber(ver.readline())
  14.     ver.close()
  15.     sleep(2)
  16.     local oldVer = fs.open("version.txt", "r")
  17.     print(oldVer.readline())
  18.     oldVersion = tonumber(oldVer.readline())
  19.     oldVer.close()
  20.     fs.delete("version.txt")
  21. end
  22. sleep(2)
  23. if newVersion > oldVersion then
  24.     UpdateAvailable = true 
  25. else
  26.     UpdateAvailable = false
  27. end
  28. sleep(2)
  29. update = fs.open("updater.txt","w")
  30. update.write(UpdateAvailable)
  31. update.close()
  32. local turbine
  33. term.clear()
  34. sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement