Marlingaming

CC Tweaked CCSPS Iron 2.0.0 - Update Version Selection

Feb 4th, 2022 (edited)
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. settings.load(".settings")
  2. local AvUpdates = {"2.0.0"}
  3. local LatestVersion = "2.0.0"
  4. local ClientV = settings.get("ClientVersion")
  5. local Paster = settings.get("osPaster")
  6. local function Clear()
  7. term.clear()
  8. term.setCursorPos(1,1)
  9. end
  10.  
  11. function CUI(m) --declare function
  12. n=1
  13. local l = #m
  14. while true do
  15. term.setCursorPos(1,5)
  16. for i=1, #m, 1 do --traverse the table of options
  17. if i==n then term.clearLine() print(i, ">",m[i]) else term.clearLine() print(i, "-", m[i]) end --print them
  18. end
  19. a, b= os.pullEvent("key") --wait for keypress
  20. if b==keys.w and n>1 then n=n-1 end
  21. if b==keys.s and n<l then n=n+1 end
  22. if b==keys.enter then break end
  23. end
  24. return n --return the value
  25. end
  26.  
  27. function UpdateMenu()
  28. Clear()
  29. print("Client Version = ",ClientV)
  30. local options = AvUpdates
  31. local n = CUI(options)
  32. local file = fs.open("os/System/Files/UpdateConfig","w")
  33. file.writeLine(options[n])
  34. file.close()
  35. shell.run(Paster,"run","esrL34E1")
  36. end
  37.  
  38. UpdateMenu()
Add Comment
Please, Sign In to add comment