Advertisement
Guest User

PixeltonOS

a guest
Nov 27th, 2014
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.18 KB | None | 0 0
  1. --Notes--
  2. --Right Mouse Click is
  3. --1
  4. --13
  5. --7
  6. --The enter key is
  7. --28
  8. --The arrow keys are
  9. --up;200
  10. --down;208
  11. --left;203
  12. --right;205
  13. --Variables--
  14. local sid = 1
  15. slc = 0
  16. w,h = term.getSize()
  17. --Functions--
  18.  
  19. function menu(id, text)
  20. if sid == id then
  21. write("[".."]")
  22. else
  23. write(" ")
  24. end
  25. print(text)
  26. end
  27.  
  28. function adminFiles()
  29. while true do
  30. term.clear()
  31. term.setCursorPos(1,1)
  32. print("+-----+------------------------+")
  33. print(":Files:                        :")
  34. print("+-----+                        :")
  35. print(":                              :")
  36. print(":                              :")
  37. print(":                              :")
  38. print("+------------------------------+")
  39. term.setCursorPos(9,2)
  40. menu(1, "..")
  41. term.setCursorPos(9,3)
  42. menu(2, "Worm")
  43. term.setCursorPos(9,4)
  44. menu(3, "CraftOS_Prompt")
  45. term.setCursorPos(9,5)
  46. menu(4, "Shutdown")
  47. term.setCursorPos(9,6)
  48. menu(5, "Reboot")
  49. term.setCursorPos(24,2)
  50. menu(6, "Info")
  51. term.setCursorPos(24,3)
  52. menu(7, "Adventure")
  53. event, key = os.pullEvent("key")
  54. if key == 200 then
  55. if sid > 1 then
  56. sid = sid - 1
  57. end
  58. elseif key == 208 then
  59. if sid < 6 then
  60. sid = sid + 1
  61. end
  62. elseif key == 28 then
  63. if sid == 1 then
  64. adminDesktop()
  65. elseif sid == 2 then
  66. term.setBackgroundColor(colors.black)
  67. term.setTextColor(colors.white)
  68. shell.run("worm")
  69. term.setBackgroundColor(colors.white)
  70. term.setTextColor(colors.black)
  71. elseif sid == 3 then
  72. term.clear()
  73. term.setCursorPos(1,1)
  74. shell.run("shell")
  75. elseif sid == 4 then
  76. os.shutdown()
  77. elseif sid == 5 then
  78. os.reboot()
  79. elseif sid == 6 then
  80. adminInfoMenu()
  81. end
  82. end
  83. end
  84. end
  85.  
  86. function cls()
  87. shell.run('clear')
  88. end
  89.  
  90. function bootUp()
  91. term.setBackgroundColor(colors.white)
  92. term.setTextColor(colors.black)
  93. term.clear()
  94. term.setCursorPos(1,1)
  95. print("+---------------+---------------------+")  
  96. print(":PixeltonOS v0.2:                     :")
  97. print("+---------------+                     :")
  98. print(":                                     :")
  99. print(":             PixeltonOS              :")
  100. print(":           ________________          :")
  101. print(":          /                \\         :")
  102. print(":          \\________________/         :")
  103. print(":                                     :")
  104. print(":              Loading...             :")
  105. print(":                                     :")
  106. print("+-------------------------------------+")
  107. sleep(1)
  108. term.setCursorPos(13,7)
  109. print("::")
  110. sleep(1)
  111. term.setCursorPos(15,7)
  112. print(":::")
  113. sleep(1)
  114. term.setCursorPos(18,7)
  115. print("::::")
  116. sleep(1)
  117. term.setCursorPos(22,7)
  118. print(":::::")
  119. sleep(1)
  120. term.setCursorPos(27,7)
  121. print("::")
  122. cls()
  123. term.setCursorPos(1,1)
  124. print("+---------------+---------------------+")
  125. print(":PixeltonOS v0.2:                     :")
  126. print("+---------------+                     :")
  127. print(":                                     :")
  128. print(":                                     :")
  129. print(":                 Done.               :")
  130. print(":                  ___                :")
  131. print(":                 /\\__\\               :")
  132. print(":                 \\/__/               :")
  133. print(":                                     :")
  134. print("+-------------------------------------+")
  135. sleep(2)
  136. userSelect()
  137. end
  138.  
  139. function userSelect()
  140. while true do
  141. cls()
  142. term.setCursorPos(1,1)
  143. print("+---------------+-------------+")
  144. print(":PixeltonOS v0.2:             :")
  145. print("+---------------+             :")
  146. print(":                             :")
  147. print(":        Please Select        :")
  148. print(":         Your User.          :")
  149. print(":                             :")
  150. print(":                             :")
  151. print(":                             :")
  152. print(":                             :")
  153. print(":                             :")
  154. print("+-----------------------------+")
  155. term.setCursorPos(11,9)
  156. menu(1, "Admin")
  157. term.setCursorPos(11,10)
  158. menu(2, "Guest")
  159. event, key = os.pullEvent("key")
  160. if key == 200 then
  161. if sid > 1 then
  162. sid = sid - 1
  163. end
  164. elseif key == 208 then
  165. if sid < 2 then
  166. sid = sid + 1
  167. end
  168. elseif key == 28 then
  169. if sid == 1 then
  170. adminDesktop()
  171. elseif sid == 2 then
  172. guestDesktop()
  173. end
  174. end
  175. end
  176. end
  177.  
  178. function guestDesktop()
  179. while true do
  180. cls()
  181. term.setCursorPos(1,1)
  182. print("++---------------+--------------------------------+")
  183. print("::Guest's Desktop:================================:")
  184. print("++---------------+-------------------------------++")
  185. print(":: _______                                       ::")
  186. print(":: :      \\                                      ::")
  187. print(":: :      :                                      ::")
  188. print(":: : /-\\  :                                      ::")
  189. print(":: : \\-/  :                                      ::")
  190. print(":: :______:                                      ::")
  191. print("::                                               ::")
  192. print(":: ____________                                  ::")
  193. print(":: :           \\                                 ::")
  194. print(":: :           :                                 ::")
  195. print(":: :___________:                                 ::")
  196. print("::                                               ::")
  197. print("++--------+--------------------------------------++")
  198. print("::        :=======================================:")
  199. print("++--------+---------------------------------------+")
  200. term.setCursorPos(3,17)
  201. menu(1, "System")
  202. term.setCursorPos(5,6)
  203. menu(2, "Worm")
  204. term.setCursorPos(5,13)
  205. menu(3, "Adventure")
  206. event, key = os.pullEvent("key")
  207. if key == 200 then
  208. if sid > 1 then
  209. sid = sid - 1
  210. end
  211. elseif key == 208 then
  212. if sid < 3 then
  213. sid = sid + 1
  214. end
  215. elseif key == 28 then
  216. if sid == 1 then
  217. systemMenu()
  218. elseif sid == 2 then
  219. term.setBackgroundColor(colors.black)
  220. term.setTextColor(colors.white)
  221. shell.run("worm")
  222. term.setBackgroundColor(colors.white)
  223. term.setTextColor(colors.black)
  224. elseif sid == 3 then
  225. term.clear()
  226. shell.run("adventure")
  227. end
  228. end
  229. end
  230. end
  231.  
  232. function systemMenu()
  233. while true do
  234. term.setCursorPos(1,13)
  235. print("+---------+")
  236. print(":         :")  
  237. print(":         :")
  238. print(":         :")
  239. print(":         :")
  240. print("+---------+")
  241. term.setCursorPos(2,14)
  242. menu(1, "Info")
  243. term.setCursorPos(2,15)
  244. menu(2, "Shutdown")
  245. term.setCursorPos(2,16)
  246. menu(3, "Reboot")
  247. term.setCursorPos(2,17)
  248. menu(4, "Exit")
  249. event, key = os.pullEvent("key")
  250. if key == 200 then
  251. if sid > 1 then
  252. sid = sid - 1
  253. end
  254. elseif key == 208 then
  255. if sid < 4 then
  256. sid = sid + 1
  257. end
  258. elseif key == 28 then
  259. if sid == 1 then
  260. infoMenu()
  261. elseif sid == 2 then
  262. os.shutdown()
  263. elseif sid == 3 then
  264. os.reboot()
  265. elseif sid == 4 then
  266. guestDesktop()
  267. end
  268. end
  269. end
  270. end
  271.  
  272. function adminSystemMenu()
  273. while true do
  274. term.setCursorPos(2,12)
  275. print("+---------+")
  276. print(":         :")
  277. print(":         :")
  278. print(":         :")
  279. print(":         :")
  280. print(":         :")
  281. print("+---------+")
  282. term.setCursorPos(2,13)
  283. menu(1, "Info")
  284. term.setCursorPos(2,14)
  285. menu(2, "MOS")
  286. term.setCursorPos(2,15)
  287. menu(3, "Shutdown")
  288. term.setCursorPos(2,16)
  289. menu(4, "Reboot")
  290. term.setCursorPos(2,17)
  291. menu(5, "Exit")
  292. event, key = os.pullEvent("key")
  293. if key == 200 then
  294. if sid > 1 then
  295. sid = sid - 1
  296. end
  297. elseif key == 208 then
  298. if sid < 5 then
  299. sid = sid + 1
  300. end
  301. elseif key == 28 then
  302. if sid == 1 then
  303. adminInfoMenu()
  304. elseif sid == 2 then
  305. cls()
  306. MOS()
  307. elseif sid == 3 then
  308. os.shutdown()
  309. elseif sid == 4 then
  310. os.reboot()
  311. elseif sid == 5 then
  312. adminDesktop()
  313. end
  314. end
  315. end
  316. end
  317.  
  318. function adminInfoMenu()
  319. while true do
  320. term.setCursorPos(1,1)
  321. print("+----+------------+")
  322. print(":Info:            :")
  323. print("+----+            :")
  324. print(":    :            :")
  325. print(":    :            :")
  326. print(":    :            :")
  327. print(":    :            :")
  328. print(":    :            :")
  329. print("+----+------------+")
  330. term.setCursorPos(8,2)
  331. menu(1, "Version")
  332. term.setCursorPos(8,4)
  333. menu(2, "Alpha")
  334. term.setCursorPos(8,6)
  335. menu(3, "OS Info")
  336. term.setCursorPos(8,8)
  337. menu(4, "Exit")
  338. event, key = os.pullEvent("key")
  339. if key == 200 then
  340. if sid > 1 then
  341. sid = sid - 1
  342. end
  343. elseif key == 208 then
  344. if sid < 4 then
  345. sid = sid + 1
  346. end
  347. elseif key == 28 then
  348. if sid == 1 then
  349. adminVersionPage()
  350. elseif sid == 2 then
  351. adminAlphaPage()
  352. elseif sid == 3 then
  353. adminInfoPage()
  354. elseif sid == 4 then
  355. adminDesktop()
  356. end
  357. end
  358. end
  359. end
  360.  
  361. function adminInfoPage()
  362. term.setCursorPos(1,1)
  363. print("+-------+--------+")
  364. print(":OS Info:This OS :")
  365. print("+-------+is made :")
  366. print(":specifically for:")
  367. print(":Pixel Studios'  :")
  368. print(":needs, and has  :")
  369. print(":few, if any,    :")
  370. print(":features for    :")
  371. print(":casual use.     :")
  372. print(":                :")
  373. print("+----------------+")
  374. term.setCursorPos(3,10)
  375. menu(1, "Exit")
  376. event, key = os.pullEvent("key")
  377. if key == 28 then
  378. if sid == 1 then
  379. adminInfoMenu()
  380. end
  381. end
  382.  
  383. function adminVersionPage()
  384. while true do
  385. term.setCursorPos(1,1)
  386. print("+----------+")
  387. print(":This OS   :")
  388. print(":is version:")
  389. print(":v0.2 Alpha:")
  390. print(":          :")
  391. print("+----------+")
  392. term.setCursorPos(3,5)
  393. menu(1, "Exit")
  394. event, key = os.pullEvent("key")
  395. if key == 200 then
  396. if sid > 1 then
  397. sid = sid - 1
  398. end
  399. elseif key == 208 then
  400. if sid < 1 then
  401. sid = sid + 1
  402. end
  403. elseif key == 28 then
  404. if sid == 1 then
  405. adminInfoMenu()
  406. end
  407. end
  408. end
  409. end
  410.  
  411. function adminAlphaPage()
  412. print("+-----+-------+")
  413. print(":Alpha:Thank  :")
  414. print("+-----+you for:")
  415. print(":using the    :")
  416. print(":alpha version:")
  417. print(":of PixeltonOS:")
  418. print(":             :")
  419. print("+-------------+")
  420. term.setCursorPos(3,7)
  421. menu(1, "Exit")
  422. event, key = os.pullEvent("key")
  423. if key == 200 then
  424. if sid > 1 then
  425. sid = sid - 1
  426. end
  427. elseif key == 208 then
  428. if sid < 1 then
  429. sid = sid + 1
  430. end
  431. elseif key == 28 then
  432. if sid == 1 then
  433. adminInfoMenu()
  434. end
  435. end
  436. end
  437. end
  438.  
  439. function infoMenu()
  440. while true do
  441. term.setCursorPos(1,1)
  442. print("+----+------------+")
  443. print(":Info:            :")
  444. print("+----+            :")
  445. print(":    :            :")
  446. print(":    :            :")
  447. print(":    :            :")
  448. print(":    :            :")
  449. print(":    :            :")
  450. print("+----+------------+")
  451. term.setCursorPos(8,2)
  452. menu(1, "Version")
  453. term.setCursorPos(8,4)
  454. menu(2, "Alpha")
  455. term.setCursorPos(8,6)
  456. menu(3, "OS Info")
  457. term.setCursorPos(8,8)
  458. menu(4, "Exit")
  459. event, key = os.pullEvent("key")
  460. if key == 200 then
  461. if sid > 1 then
  462. sid = sid - 1
  463. end
  464. elseif key == 208 then
  465. if sid < 4 then
  466. sid = sid + 1
  467. end
  468. elseif key == 28 then
  469. if sid == 1 then
  470. versionPage()
  471. elseif sid == 2 then
  472. alphaPage()
  473. elseif sid == 3 then
  474. infoPage()
  475. elseif sid == 4 then
  476. guestDesktop()
  477. end
  478. end
  479. end
  480. end
  481.  
  482. function infoPage()
  483. while true do
  484. term.setCursorPos(1,1)
  485. print("+-------+--------+")
  486. print(":OS Info:This OS :")
  487. print("+-------+is made :")
  488. print(":specifically for:")
  489. print(":Pixel Studios'  :")
  490. print(":needs.There is  :")
  491. print(":very little, if :")
  492. print(":any, features   :")
  493. print(":for casual use. :")
  494. print(":                :")
  495. print("+----------------+")
  496. term.setCursorPos(3,10)
  497. menu(1, "Exit")
  498. event, key = os.pullEvent("key")
  499. if key == 200 then
  500. if sid > 1 then
  501. sid = sid - 1
  502. end
  503. elseif key == 208 then
  504. if sid < 1 then
  505. sid = sid + 1
  506. end
  507. elseif key == 28 then
  508. if sid == 1 then
  509. infoMenu()
  510. end
  511. end
  512. end
  513. end
  514.  
  515. function alphaPage()
  516. term.setCursorPos(1,1)
  517. print("+-----+-------+")
  518. print(":Alpha:Thank  :")
  519. print("+-----+you for:")
  520. print(":using the    :")
  521. print(":alpha version:")
  522. print(":of PixeltonOS:")
  523. print(":             :")
  524. print("+-------------+")
  525. term.setCursorPos(3,7)
  526. menu(1, "Exit")
  527. event, key = os.pullEvent("key")
  528. if key == 200 then
  529. if sid > 1 then
  530. sid =sid - 1
  531. end
  532. elseif key == 208 then
  533. if sid < 1 then
  534. sid = sid + 1
  535. end
  536. elseif key == 28 then
  537. if sid == 1 then
  538. infoMenu()
  539. end
  540. end
  541. end
  542.  
  543.  
  544. function versionPage()
  545. while true do
  546. term.setCursorPos(1,1)
  547. print("+----------+")
  548. print(":The OS    :")
  549. print(":version is:")
  550. print(":v0.2 Alpha:")
  551. print(":          :")
  552. print("+----------+")
  553. term.setCursorPos(3,5)
  554. menu(1, "Exit")
  555. event, key = os.pullEvent("key")
  556. if key == 200 then
  557. if sid > 1 then
  558. sid = sid - 1
  559. end
  560. elseif key == 208 then
  561. if sid < 1 then
  562. sid = sid + 1
  563. end
  564. elseif key == 28 then
  565. if sid == 1 then
  566. infoMenu()
  567. end
  568. end
  569. end
  570. end
  571.  
  572. function MOS()
  573. local r = read()
  574. cls()
  575. term.setCursorPos(1,1)
  576. print("Minecraft-Operating-System, or MOS, is")
  577. print("a product of PixelStudios. Use of MOS ")
  578. print("as your own is prohibited. MOS is a")
  579. print("part of PixeltonOS and is in alpha.")
  580. print("Thank you for using MOS as your OS.")
  581. read()
  582. if r == "Exit" then
  583. adminDesktop()
  584. elseif r == "Users" then
  585. userList()
  586. read()
  587. elseif r == "cls" then
  588. cls()
  589. read()
  590. elseif r == "games" then
  591. gamesList()
  592. read()
  593. end
  594. end
  595.  
  596. function gamesList()
  597. print("Games: None")
  598. end
  599.  
  600. function userList()
  601. print("Users:")
  602. print("Admin")
  603. print("Guest")
  604. end
  605.  
  606. function adminDesktop()
  607. while true do
  608. cls()
  609. term.setCursorPos(1,1)
  610. print("+---------------+---------------------------------+")
  611. print(":Admin's Desktop:=================================:")
  612. print("++--------------+--------------------------------++")
  613. print("::_______                                        ::")
  614. print(":::      \\                                       ::")
  615. print(":::      :                                       ::")
  616. print(":::      :                                       ::")
  617. print(":::      :                                       ::")
  618. print(":::______:                                       ::")
  619. print("::                                               ::")
  620. print("::                                               ::")
  621. print("::                                               ::")
  622. print("::                                               ::")
  623. print("::                                               ::")
  624. print("::                                               ::")
  625. print("++-------+---------------------------------------++")
  626. print(":        :========================================:")
  627. print("+--------+----------------------------------------+")
  628. term.setCursorPos(2,17)
  629. menu(1, "System")
  630. term.setCursorPos(4,6)
  631. menu(2, "FileM")
  632. event, key = os.pullEvent("key")
  633. if key == 200 then
  634. if sid > 1 then
  635. sid = sid - 1
  636. end
  637. elseif key == 208 then
  638. if sid < 2 then
  639. sid = sid + 1
  640. end
  641. elseif key == 28 then
  642. if sid == 1 then
  643. adminSystemMenu()
  644. elseif sid == 2 then
  645. adminFiles()
  646. end
  647. end
  648. end
  649. end
  650.  
  651. --CodeForOS--
  652. bootUp()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement