Advertisement
TaZeOS

os/programs/terminal/start.lua

Nov 7th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.28 KB | None | 0 0
  1. log(" ")
  2. log(" ")
  3. log("Terminal Started")
  4. log(" ")
  5. log(" ")
  6.  
  7.  
  8. function s(...) return sleep(...) end
  9. function w(...) return write(...) end
  10. function p(...) return print(...) end
  11. function tw(...) return term.write(...) end
  12. function scp(...) return term.setCursorPos(...) end
  13. function sbc(...) return term.setBackgroundColor(...) end
  14. function stc(...) return term.setTextColor(...) end
  15. function tc(...) return term.clear(...) end
  16. function tcl(...) return term.clearLine() end
  17. function scb(...) return term.setCursorBlink(...) end
  18. function ts(...) return term.scroll(...) end
  19. function r(...) return shell.run(...) end
  20. function para(...) return parallel.waitForAny(...) end
  21. function sw(...) return textutils.slowWrite(...) end
  22. function sp(...) return textutils.slowPrint(...) end
  23. log("==> Adding taskbar")
  24. taskbar.setVisible(true)
  25. log("==> Creating app window")
  26. terminalwindow = window.create(term.current(),1,2,51,18)
  27. terminalwindow.setBackgroundColor(colors.black)
  28. terminalwindow.clear()
  29. logo = paintutils.loadImage("OS/Programs/Terminal/Terminal.png")
  30. paintutils.drawImage(logo, 1, 1 )
  31. terminalwindow.setCursorPos(20,15)
  32. terminalwindow.setTextColor(colors.white)
  33. terminalwindow.setBackgroundColor(colors.black)
  34. terminalwindow.write("Terminal")
  35. if admin == "true" then
  36.  
  37. else
  38. adminpopup = window.create(term.current(),12,7,25,10)
  39. adminpopup.setBackgroundColor(colors.white)
  40. adminpopup.clear()
  41. adminpopup.setCursorPos(1,1)
  42. adminpopup.setBackgroundColor(colors.red)
  43. adminpopup.write(" Admin Login ")
  44. adminpopup.setTextColor(colors.black)
  45. adminpopup.setCursorPos(2,2)
  46. adminpopup.setBackgroundColor(colors.white)
  47. adminpopup.write("Please login as a admin.")
  48. adminpopup.setCursorPos(2,3)
  49. adminpopup.write("To access \"Terminal\"")
  50. adminpopup.setCursorPos(2,5)
  51. adminpopup.write("Username:")
  52. adminpopup.setCursorPos(2,6)
  53. adminpopup.setBackgroundColor(colors.lightGray)
  54. adminpopup.write(" ")
  55. adminpopup.setCursorPos(2,8)
  56. adminpopup.setBackgroundColor(colors.white)
  57. adminpopup.write("Password:")
  58. adminpopup.setCursorPos(2,9)
  59. adminpopup.setBackgroundColor(colors.lightGray)
  60. adminpopup.write(" ")
  61.  
  62. while true do
  63.  
  64.  
  65. scp(13,12)
  66. sbc(colors.lightGray)
  67. username = read()
  68. scp(13,15)
  69. sbc(colors.lightGray)
  70. password = read("*")
  71. logincheck = fs.open("OS/Users/1/info.data", "r")
  72. if logincheck then
  73. username1 = logincheck.readLine()
  74. userpass1 = logincheck.readLine()
  75. admin = logincheck.readLine()
  76. logincheck.close()
  77. end
  78. checkUser()
  79.  
  80. if username == UserInfo[1][1] and password == UserInfo[1][2] and admin1 == "true" or username == UserInfo[2][1] and password == UserInfo[2][2] and admin2 == "true" or username == UserInfo[3][1] and password == UserInfo[3][2] and admin3 == "true" or username == UserInfo[4][1] and password == UserInfo[4][2] and admin4 == "true" then
  81.  
  82.  
  83. logincheck = fs.open("OS/Users/1/info.data", "r")
  84. if logincheck then
  85. username1 = logincheck.readLine()
  86. userpass1 = logincheck.readLine()
  87. admin = logincheck.readLine()
  88. logincheck.close()
  89. end
  90.  
  91.  
  92. terminalwindow.clear()
  93. paintutils.drawImage(logo, 1, 1 )
  94. terminalwindow.setCursorPos(20,15)
  95. terminalwindow.setTextColor(colors.white)
  96. terminalwindow.setBackgroundColor(colors.black)
  97. terminalwindow.write("Terminal")
  98.  
  99. break
  100. else
  101. shell.run('OS/desktop.lua')
  102.  
  103. end
  104. end
  105.  
  106. end
  107. sleep(4)
  108. log("==> Prossecing animation")
  109. terminalwindow.setBackgroundColor(colors.black)
  110. terminalwindow.clear()
  111. paintutils.drawImage(logo, 5, 1 )
  112. terminalwindow.setCursorPos(25,15)
  113. terminalwindow.setTextColor(colors.white)
  114. terminalwindow.setBackgroundColor(colors.black)
  115. terminalwindow.write("Terminal")
  116. sleep(0.1)
  117.  
  118.  
  119.  
  120.  
  121. terminalwindow.setBackgroundColor(colors.black)
  122. terminalwindow.clear()
  123. paintutils.drawImage(logo, 10, 1 )
  124. terminalwindow.setCursorPos(30,15)
  125. terminalwindow.setTextColor(colors.white)
  126. terminalwindow.setBackgroundColor(colors.black)
  127. terminalwindow.write("Terminal")
  128. sleep(0.1)
  129.  
  130.  
  131.  
  132. terminalwindow.setBackgroundColor(colors.black)
  133. terminalwindow.clear()
  134. paintutils.drawImage(logo, 15, 1 )
  135. terminalwindow.setCursorPos(35,15)
  136. terminalwindow.setTextColor(colors.white)
  137. terminalwindow.setBackgroundColor(colors.black)
  138. terminalwindow.write("Terminal")
  139. sleep(0.1)
  140.  
  141.  
  142.  
  143.  
  144. terminalwindow.setBackgroundColor(colors.black)
  145. terminalwindow.clear()
  146. paintutils.drawImage(logo, 20, 1 )
  147. terminalwindow.setCursorPos(40,15)
  148. terminalwindow.setTextColor(colors.white)
  149. terminalwindow.setBackgroundColor(colors.black)
  150. terminalwindow.write("Terminal")
  151. sleep(0.1)
  152.  
  153.  
  154.  
  155. terminalwindow.setBackgroundColor(colors.black)
  156. terminalwindow.clear()
  157. paintutils.drawImage(logo, 25, 1 )
  158. terminalwindow.setCursorPos(45,15)
  159. terminalwindow.setTextColor(colors.white)
  160. terminalwindow.setBackgroundColor(colors.black)
  161. terminalwindow.write("Terminal")
  162. sleep(0.1)
  163.  
  164.  
  165.  
  166. terminalwindow.setBackgroundColor(colors.black)
  167. terminalwindow.clear()
  168. paintutils.drawImage(logo, 30, 1 )
  169. terminalwindow.setCursorPos(50,15)
  170. terminalwindow.setTextColor(colors.white)
  171. terminalwindow.setBackgroundColor(colors.black)
  172. terminalwindow.write("Terminal")
  173. sleep(0.1)
  174.  
  175.  
  176.  
  177. terminalwindow.setBackgroundColor(colors.black)
  178. terminalwindow.clear()
  179. paintutils.drawImage(logo, 32, 1 )
  180. terminalwindow.setCursorPos(51,15)
  181. terminalwindow.setTextColor(colors.white)
  182. terminalwindow.setBackgroundColor(colors.black)
  183. terminalwindow.write("Terminal")
  184. sleep(0.1)
  185.  
  186.  
  187. terminalwindow.setBackgroundColor(colors.black)
  188. terminalwindow.clear()
  189. paintutils.drawImage(logo, 35, 1 )
  190.  
  191. sleep(2)
  192. taskbar.setCursorPos(1,1)
  193. log("==> Terminal Started!")
  194. taskbar.write(" Terminal - To Exit Type \"Exit\"")
  195. while true do
  196. i = 1
  197. taskbar.redraw()
  198. scp(1,3)
  199. repeat
  200. sbc(colors.black)
  201. i = i + 1
  202.  
  203. cmd = read()
  204. if cmd == "exit" or cmd == "Exit" then
  205. log("==> User typed Exit... Exiting terminal.lua")
  206. shell.run('OS/desktop.lua')
  207. else
  208. log("==> Running command \""..cmd.."\"")
  209. shell.run(cmd)
  210. end
  211. until i == 5
  212. log("==> User typed over 5 commands... Clearing terminal")
  213. terminalwindow.setBackgroundColor(colors.black)
  214. terminalwindow.clear()
  215. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement