5bitesofcookies

Glass3.0Options(BETA1R1)

Oct 17th, 2013
489
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. clearAll()
  2.  
  3. local function usernameS()
  4. tinyClear()
  5. tinyPrint("What is your new desired",1,glcolors.otherBlue)
  6. tinyPrint("username?",2,glcolors.otherBlue)
  7. local evt, cmd = os.pullEvent("chat_command")
  8. tinyClear()
  9. newusername = fs.open("username", "w")
  10. newusername.writeLine(cmd)
  11. newusername.close()
  12. username = cmd
  13. tinyPrint("Alright, "..cmd..",",1,glcolors.otherBlue)
  14. tinyPrint("Settings will take affect",2,glcolors.otherBlue)
  15. tinyPrint("immediately.",3,glcolors.otherBlue)
  16. sleep(2)
  17. end
  18. local function trans()
  19. tinyClear()
  20. tinyPrint("How transparent do you want",1,glcolors.otherBlue)
  21. tinyPrint("glass? (default level is 0.75)",2,glcolors.otherBlue)
  22. local evt, cmd = os.pullEvent("chat_command")
  23. --we don't need it to be a number, but it's like
  24. --a safety feature
  25. cmd = tonumber(cmd)
  26. if cmd == nil then
  27. tinyClear()
  28. tinyPrint("You need to enter a number.",1,glcolors.otherBlue)
  29. sleep(2)
  30. else
  31. tr = fs.open("glasstrans", "w")
  32. tr.write(cmd)
  33. tr.close()
  34. tinyClear()
  35. tinyPrint("You'll need to reboot glass",1,glcolors.otherBlue)
  36. tinyPrint("for this to work.",2,glcolors.otherBlue)
  37. sleep(2)
  38. end
  39. end
  40. function updGlass()
  41. shell.run('pastebin get yJgWrGpY installeralpha')
  42. tinyClear()
  43. tinyPrint("Will quit glass aswell.",1,glcolors.otherBlue)
  44. sleep(1)
  45. autoUpdate = true
  46. shell.run("installeralpha")
  47. goodShutdown = true
  48. on = false
  49. end
  50. function update()
  51. tinyClear()
  52. tinyPrint("Getting the current",1,glcolors.otherBlue)
  53. tinyPrint("version from pastebin...",2,glcolors.otherBlue)
  54. if fs.exists("vertemp") == true then fs.delete("vertemp") end
  55. shell.run("pastebin get n2x4xWXn vertemp")
  56. f = fs.open("vertemp", "r")
  57. curVer = f.readLine()
  58. curVer = tonumber(curVer)
  59. f.close()
  60. tinyClear()
  61. if glassVer < curVer then
  62. tinyPrint("Glass is not up to date!",1,glcolors.otherBlue)
  63. tinyPrint("Would you like to update?",2,glcolors.otherBlue)
  64. tinyPrint("(y/n)",3,glcolors.otherBlue)
  65. local evt, cmd = os.pullEvent("chat_command")
  66. cmd = string.lower(cmd)
  67. if cmd == "y" or cmd == "yes" then
  68. updGlass()
  69. end
  70. elseif glassVer > curVer then
  71. tinyPrint("You're running a dev version",1,glcolors.otherBlue)
  72. tinyPrint("?!?!?!?!?!",2,glcolors.otherBlue)
  73. sleep(5)
  74. else
  75. tinyPrint("Glass is up to date",1,glcolors.otherBlue)
  76. sleep(5)
  77. end
  78. end
  79. local function theme()
  80. clearAll()
  81. tinyCPrint("Themes:",1,glcolors.red)
  82. tinyPrint("default, inverted, ",2,glcolors.otherBlue)
  83. tinyPrint("night,swapped,",3,glcolors.otherBlue)
  84. tinyPrint("greenEdit, purpleEdit",4,glcolors.otherBlue)
  85. local evt, cmd = os.pullEvent("chat_command")
  86. cmd = cmd:lower()
  87. if cmd == "inverted" then
  88. bigBoxColor = glcolors.black
  89. sideColors = glcolors.darkBlue
  90. elseif cmd == "default" then
  91. bigBoxColor = glcolors.gray sideColors = glcolors.blue
  92. elseif cmd == "night" then
  93. bigBoxColor = glcolors.darkBlue
  94. sideColors = glcolors.black
  95. elseif cmd == "swapped" then
  96. bigBoxColor = glcolors.blue
  97. sideColors = glcolors.gray
  98. elseif cmd == "greenedit" then
  99. bigBoxColor = glcolors.gray
  100. sideColors = glcolors.green
  101. elseif cmd == "purpleedit" then
  102. bigBoxColor = glcolors.gray
  103. sideColors = glcolors.purple
  104. end
  105. change = fs.open("glassTheme","w")
  106. change.writeLine("bigBoxColor = "..bigBoxColor.." sideColors = "..sideColors.." ")
  107. change.close()
  108. end
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. local function main()
  119. while true do
  120. tinyClear()
  121. tinyCPrint("Avalible Options:",1,glcolors.red)
  122. tinyPrint("username, update,",2,glcolors.otherBlue)
  123. tinyPrint("transparency, theme, exit",3,glcolors.otherBlue)
  124. local evt, cmd = os.pullEvent("chat_command")
  125. cmd = string.lower(cmd)
  126. if cmd == "username" then
  127. usernameS()
  128. elseif cmd == "update" then
  129. update()
  130. elseif cmd == "transparency" then
  131. trans()
  132. elseif cmd == "theme" then
  133. theme()
  134. elseif cmd == "exit" then
  135. error()
  136. end
  137. end
  138. end
  139. main()
Advertisement
Add Comment
Please, Sign In to add comment