Advertisement
Guest User

Untitled

a guest
Mar 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.67 KB | None | 0 0
  1. local password = ""
  2. local username = ""
  3.  
  4. if fs.exists("sensData1") then
  5. local hRead = assert(fs.open("sensData1", "r"))
  6. saveName = hRead.readLine()
  7. hRead.close()
  8. end
  9. if fs.exists("sensData2") then
  10. local hRead = assert(fs.open("sensData2", "r"))
  11. savePassword = hRead.readLine()
  12. hRead.close()
  13. end
  14.  
  15. function drawBorder()
  16. term.clear()
  17. term.setCursorPos(1,1)
  18. print("X-------------------------------------------------X")
  19. print("- -")
  20. print("- -")
  21. print("- -")
  22. print("- -")
  23. print("- -")
  24. print("- -")
  25. print("- -")
  26. print("- -")
  27. print("- -")
  28. print("- -")
  29. print("- -")
  30. print("- -")
  31. print("- -")
  32. print("- -")
  33. print("- -")
  34. print("- -")
  35. print("X-------------------------------------------------X")
  36. end
  37. function loginSeq()
  38. term.clear()
  39. drawBorder()
  40. term.setCursorPos(15,6)
  41. print("PriestleyOS v1")
  42. term.setCursorPos(14,7)
  43. print("X---------------------X")
  44. term.setCursorPos(14,8)
  45. print("- Username: -")
  46. term.setCursorPos(14,9)
  47. print("- Password: -")
  48. term.setCursorPos(14,10)
  49. print("X---------------------X")
  50. while password ~= savePassword do
  51. term.setCursorPos(26,8)
  52. username = read()
  53. if username == saveName then
  54. term.setCursorPos(26,9)
  55. password = read("*")
  56. end
  57. term.clear()
  58. drawBorder()
  59. loginSeq()
  60. end
  61. end
  62.  
  63.  
  64.  
  65. function drawDesktop()
  66. local dMenu = 0
  67. local cpX = 12
  68. local cpY = 12
  69. local option = 1
  70.  
  71. drawBorder()
  72. term.setCursorPos(1,16)
  73. print("X-------------------------------------------------X")
  74. print("X- Applications ----- Log Off --------- Shutdown -X")
  75. term.setCursorPos(1,2)
  76. print("X- PriestleyOS v1 User: "..username)
  77. print("X-------------------------------------------------X")
  78.  
  79. while dMenu ~= 1 do
  80.  
  81. drawBorder()
  82. term.setCursorPos(1,16)
  83. print("X-------------------------------------------------X")
  84. print("X- Applications ----- Log Off --------- Shutdown -X")
  85. term.setCursorPos(1,2)
  86. print("X- PriestleyOS v1 User: "..username)
  87. print("X-------------------------------------------------X")
  88.  
  89. if option == -1 then
  90. option = 3
  91. cpY = 43
  92. end
  93. if option == 1 then
  94. cpY = 8
  95. end
  96. if option == 2 then
  97. cpY = 25
  98. end
  99. if option == 3 then
  100. cpY = 43
  101. end
  102. if option == 4 then
  103. option = 1
  104. drawDesktop()
  105. end
  106.  
  107. cpX = 12
  108. term.setCursorPos(cpY,cpX)
  109. print("III")
  110. cpX = cpX + 1
  111. term.setCursorPos(cpY,cpX)
  112. print("III")
  113. cpX = cpX + 1
  114. term.setCursorPos(cpY,cpX)
  115. print("III")
  116. cpX = cpX + 1
  117. term.setCursorPos(cpY,cpX)
  118. print("VVV")
  119.  
  120.  
  121. while true do
  122. local sEvent, param = os.pullEvent("key")
  123. if sEvent == "key" then
  124. if param == 203 then
  125. option = option - 1
  126. break
  127. end
  128. if param == 205 then
  129. option = option + 1
  130. break
  131. end
  132. if param == 28 then
  133. if option == 1 then
  134. osApps()
  135. end
  136. if option == 2 then
  137. loginSeq()
  138. end
  139. if option == 3 then
  140. shutdown()
  141. end
  142. end
  143. end
  144. end
  145. end
  146. end
  147. function shutdown()
  148. drawBorder()
  149. term.setCursorPos(19,8)
  150. write("Shutting down...")
  151. term.setCursorPos(19,9)
  152. for loadloop = 0, 16 do
  153. write("=")
  154. sleep(0.25)
  155. end
  156. os.shutdown()
  157. end
  158. function osApps()
  159. local dMenu = 0
  160. local cpX = 27
  161. local cpY = 4
  162. local option = 1
  163.  
  164. drawBorder()
  165. term.setCursorPos(1,2)
  166. print("- Applications -")
  167. print("X-------------------------------------------------X")
  168. print("X- [1] Calculator -X")
  169. print("X- [2] PriestleyPapers -X")
  170. print("X- [3] PriestleyNet -X")
  171. print("X- [4] NewarkLife -X")
  172. print("X- [5] plcgame -X")
  173. print("X- Return to Desktop -X")
  174. print("X------------------------X")
  175.  
  176. while dMenu ~= 1 do
  177. if option == 7 then
  178. option = 1
  179. end
  180. if option == -1 then
  181. option = 6
  182. end
  183. drawBorder()
  184. term.setCursorPos(1,2)
  185. print("- Applications -")
  186. print("X-------------------------------------------------X")
  187. print("X- [1] Calculator -X")
  188. print("X- [2] PriestleyPapers -X")
  189. print("X- [3] PriestleyNet -X")
  190. print("X- [4] NewarkLife -X")
  191. print("X- [5] plcgame -X")
  192. print("X- Return to Desktop -X")
  193. print("X------------------------X")
  194.  
  195. if option == 1 then
  196. cpY = 4
  197. end
  198. if option == 2 then
  199. cpY = 5
  200. end
  201. if option == 3 then
  202. cpY = 6
  203. end
  204. if option == 4 then
  205. cpY = 7
  206. end
  207. if option == 5 then
  208. cpY = 8
  209. end
  210. if option == 6 then
  211. cpY = 9
  212. end
  213.  
  214. term.setCursorPos(cpX,cpY)
  215. print("<==")
  216.  
  217.  
  218. while true do
  219. local sEvent, param = os.pullEvent("key")
  220. if sEvent == "key" then
  221. if param == 200 then
  222. option = option - 1
  223. break
  224. end
  225. if param == 208 then
  226. option = option + 1
  227. break
  228. end
  229. if param == 28 then
  230. if option == 1 then
  231. startCalculator()
  232. end
  233. if option == 2 then
  234. startPriestleyPapers()
  235. end
  236. if option == 3 then
  237. startPriestleyNet()
  238. end
  239. if option == 4 then
  240.  
  241. end
  242. if option == 5 then
  243.  
  244. end
  245. if option == 6 then
  246. drawDesktop()
  247. end
  248. end
  249. end
  250. end
  251. end
  252. end
  253. function startCalculator()
  254.  
  255. end
  256. function startPriestleyPapers()
  257.  
  258. end
  259. function startPriestleyNet()
  260.  
  261. end
  262.  
  263. loginSeq()
  264. drawDesktop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement