Advertisement
Guest User

PixeltonOS

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