Advertisement
milkshake

TekMain Welcome Screen

Jun 24th, 2015
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 11.28 KB | None | 0 0
  1. -- Custom monitor program 0-0-3
  2. -- Works with: Advanced Computer & Monitor
  3. -- Environment Tested: Minecraft 1.6.4 Computer Craft version 1.5
  4. -- By RCMilkshakebunny @
  5. -- Download this file here >> http://pastebin.com/fBKRSMqN
  6.  
  7. -- ##########################
  8. -- DEFINE VARIABLES -- BEGIN
  9.  
  10. -- Define peripheral monitor side
  11. m = peripheral.wrap("monitor_19")
  12.  
  13. -- DEFINE VARIABLES -- END
  14. -- ##########################
  15.  
  16. -- ##########################
  17. -- FUNCTIONS - BEGIN
  18.  
  19. -- set the cursor position on the monitor ready to write
  20. -- in this case 1,1 means the first line at the first character. so for western based code that would be TOP,LEFT
  21. -- if we were to put (5,10) then the cursor would begin at the 5th line down and the 10th character position in from the left
  22. -- in this case the function requires the value to be given in the call
  23. function cursor(p1,p2)
  24.   m.setCursorPos(p1,p2)
  25. end
  26.  
  27. -- clear any content on the monitor function
  28. function clearMon()
  29.   m.clear()
  30. end
  31.  
  32. -- set text color function
  33. function textColor(setTo)
  34. -- set the color the text will be
  35. -- in this case blue
  36. -- the choices: white | orange | magenta | lightBlue | yellow | lime | pink | gray
  37. --   contd.. | lightGray | cyan | purple | blue | brown | green | red | black
  38. -- you can also reference colors by a 'decimal value' without the requirement of the use of 'colors'
  39. -- an example of referencing a color for text by decimal is
  40. -- m.setTextColor(512) and this would produce the same result as m.setTextColor(colors.cyan)
  41. -- m.setTextColor(colors.blue) -- << basic usage
  42.   m.setTextColor(setTo)-- << dynamic usage
  43. end
  44.  
  45. -- write to monitor function
  46. function monitorWrite(txt)
  47.   m.write(txt)
  48. end
  49.  
  50. -- monitor set new line
  51. function nl()
  52.   local _,cY= m.getCursorPos()
  53.   m.setCursorPos(1,cY+1)
  54. end
  55.  
  56. -- Monitor Center text
  57. function monCenterText(text)
  58.   local x,y = m.getSize()
  59.   local x2,y2 = m.getCursorPos()
  60.   m.setCursorPos(math.ceil((x / 2) - (text:len() / 2)), y2)
  61.   m.write(text)
  62. end
  63.  
  64. --initialise monitor function
  65. function mInit()
  66.   clearMon()
  67.   cursor(1,1)
  68.   textColor(512)
  69. end
  70.  
  71. -- ##########################
  72. -- TERMINAL FUNCTIONS -- BEGIN
  73.  
  74. -- clears terminal
  75. function clearTerm()
  76.   term.clear()
  77. end
  78.  
  79. -- writes to the terminal
  80. function writeTerm(termtext)
  81.   term.write(termtext)
  82. end
  83.  
  84. -- set terminal cursor position -- Dynamic
  85. function termCursor(p1,p2)
  86.   term.setCursorPos(p1,p2)
  87. end
  88.  
  89. -- terminal set new line
  90. function term_nl()
  91.   local _,cY= term.getCursorPos()
  92.   term.setCursorPos(1,cY+1)
  93. end
  94.  
  95. -- TERMINAL FUNCTIONS -- END
  96. -- ##########################
  97.  
  98. -- ##########################
  99. -- PAGES  BEGIN
  100.  
  101. function bottomSec()
  102.   nl()
  103.   monitorWrite("                 /survival - /pvp - /factions - /games                    ")
  104. end
  105.  
  106. function bottomBar()
  107.   nl()
  108.   nl()
  109.   nl()
  110.   monitorWrite(" Welcome to RC-Tekkit ")
  111.   nl()
  112.   monitorWrite(" - /warp from the hub to the game you want to play.")  
  113.   nl()
  114.   m.setTextColor(32)
  115.   monitorWrite("  Open: /survival")
  116.   nl()
  117.   m.setTextColor(128)
  118.   monitorWrite(" - Closed: /pvp /factions /games (In development) ")  
  119.   nl()  
  120.   monitorWrite(" Type /warp followed by the gametype. Ex. /warp survival")
  121. end
  122.  
  123. function page1()
  124.   nl()
  125.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  126.   nl()
  127.   monitorWrite("       _______  ______  _  __ _  __ _____  _______   ")
  128.   nl()
  129.   monitorWrite("      |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  130.   nl()
  131.   monitorWrite("         | |   | |__   | ' / | ' /   | |     | |     ")
  132.   nl()
  133.   monitorWrite("         | |   |  __|  |  <  |  <    | |     | |     ")
  134.   nl()
  135.   monitorWrite("         | |   | |____ | . \\ | . \\  _| |_    | |     ")
  136.   nl()
  137.   monitorWrite("         |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  138.   nl()
  139.   nl()
  140.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  141.   bottomSec()
  142.   bottomBar()
  143. end
  144.  
  145. function page2()
  146.   nl()
  147.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  148.   nl()
  149.   monitorWrite("         _______  ______  _  __ _  __ _____  _______   ")
  150.   nl()
  151.   monitorWrite("        |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  152.   nl()
  153.   monitorWrite("           | |   | |__   | ' / | ' /   | |     | |     ")
  154.   nl()
  155.   monitorWrite("           | |   |  __|  |  <  |  <    | |     | |     ")
  156.   nl()
  157.   monitorWrite("           | |   | |____ | . \\ | . \\  _| |_    | |     ")
  158.   nl()
  159.   monitorWrite("           |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  160.   nl()
  161.   nl()
  162.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  163.   bottomSec()
  164.   bottomBar()
  165. end
  166.  
  167. function page3()
  168.   nl()
  169.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  170.   nl()
  171.   monitorWrite("           _______  ______  _  __ _  __ _____  _______   ")
  172.   nl()
  173.   monitorWrite("          |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  174.   nl()
  175.   monitorWrite("             | |   | |__   | ' / | ' /   | |     | |     ")
  176.   nl()
  177.   monitorWrite("             | |   |  __|  |  <  |  <    | |     | |     ")
  178.   nl()
  179.   monitorWrite("             | |   | |____ | . \\ | . \\  _| |_    | |     ")
  180.   nl()
  181.   monitorWrite("             |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  182.   nl()
  183.   nl()
  184.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  185.   bottomSec()
  186.   bottomBar()
  187. end
  188.  
  189. function page4()
  190.   nl()
  191.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  192.   nl()
  193.   monitorWrite("             _______  ______  _  __ _  __ _____  _______   ")
  194.   nl()
  195.   monitorWrite("            |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  196.   nl()
  197.   monitorWrite("               | |   | |__   | ' / | ' /   | |     | |     ")
  198.   nl()
  199.   monitorWrite("               | |   |  __|  |  <  |  <    | |     | |     ")
  200.   nl()
  201.   monitorWrite("               | |   | |____ | . \\ | . \\  _| |_    | |     ")
  202.   nl()
  203.   monitorWrite("               |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  204.   nl()
  205.   nl()
  206.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  207.   bottomSec()
  208.   bottomBar()
  209. end
  210.  
  211. function page5()
  212.   nl()
  213.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  214.   nl()
  215.   monitorWrite("               _______  ______  _  __ _  __ _____  _______   ")
  216.   nl()
  217.   monitorWrite("              |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  218.   nl()
  219.   monitorWrite("                 | |   | |__   | ' / | ' /   | |     | |     ")
  220.   nl()
  221.   monitorWrite("                 | |   |  __|  |  <  |  <    | |     | |     ")
  222.   nl()
  223.   monitorWrite("                 | |   | |____ | . \\ | . \\  _| |_    | |     ")
  224.   nl()
  225.   monitorWrite("                 |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  226.   nl()
  227.   nl()
  228.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  229.   bottomSec()
  230.   bottomBar()
  231. end
  232.  
  233. function page6()
  234.   nl()
  235.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  236.   nl()
  237.   monitorWrite("                 _______  ______  _  __ _  __ _____  _______   ")
  238.   nl()
  239.   monitorWrite("                |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  240.   nl()
  241.   monitorWrite("                   | |   | |__   | ' / | ' /   | |     | |     ")
  242.   nl()
  243.   monitorWrite("                   | |   |  __|  |  <  |  <    | |     | |     ")
  244.   nl()
  245.   monitorWrite("                   | |   | |____ | . \\ | . \\  _| |_    | |     ")
  246.   nl()
  247.   monitorWrite("                   |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  248.   nl()
  249.   nl()
  250.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  251.   bottomSec()
  252.   bottomBar()
  253. end
  254.  
  255. function page7()
  256.   nl()
  257.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  258.   nl()
  259.   monitorWrite("                   _______  ______  _  __ _  __ _____  _______   ")
  260.   nl()
  261.   monitorWrite("                  |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  262.   nl()
  263.   monitorWrite("                     | |   | |__   | ' / | ' /   | |     | |     ")
  264.   nl()
  265.   monitorWrite("                     | |   |  __|  |  <  |  <    | |     | |     ")
  266.   nl()
  267.   monitorWrite("                     | |   | |____ | . \\ | . \\  _| |_    | |     ")
  268.   nl()
  269.   monitorWrite("                     |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  270.   nl()
  271.   nl()
  272.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  273.   bottomSec()
  274.   bottomBar()
  275. end
  276.  
  277. function page8()
  278.   nl()
  279.   monitorWrite("..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..")
  280.   nl()
  281.   monitorWrite("                     _______  ______  _  __ _  __ _____  _______   ")
  282.   nl()
  283.   monitorWrite("                    |__   __||  ____|| |/ /| |/ /|_   _||__   __|  ")
  284.   nl()
  285.   monitorWrite("                       | |   | |__   | ' / | ' /   | |     | |     ")
  286.   nl()
  287.   monitorWrite("                       | |   |  __|  |  <  |  <    | |     | |     ")
  288.   nl()
  289.   monitorWrite("                       | |   | |____ | . \\ | . \\  _| |_    | |     ")
  290.   nl()
  291.   monitorWrite("                       |_|   |______||_|\\_\\|_|\\_\\|_____|   |_|     ")
  292.   nl()
  293.   nl()
  294.   monitorWrite("--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--..--")
  295.   bottomSec()
  296.   bottomBar()
  297. end
  298.  
  299.   function leftRight()
  300.     mInit()
  301.     page1()
  302.     sleep(0.1)
  303.     mInit()
  304.     page2()
  305.     sleep(0.1)
  306.     mInit()
  307.     page3()
  308.     sleep(0.1)
  309.     mInit()
  310.     page4()
  311.     sleep(0.1)
  312.     mInit()
  313.     page5()
  314.     sleep(0.1)
  315.     mInit()
  316.     page6()
  317.     sleep(0.1)
  318.     mInit()
  319.     page7()
  320.     sleep(0.1)
  321.     mInit()
  322.     page8()
  323.     sleep(0.1)
  324.   end
  325.  
  326.   function rightLeft()
  327.     mInit()
  328.     page8()
  329.     sleep(0.1)
  330.     mInit()
  331.     page7()
  332.     sleep(0.1)
  333.     mInit()
  334.     page6()
  335.     sleep(0.1)
  336.     mInit()
  337.     page5()
  338.     sleep(0.1)
  339.     mInit()
  340.     page4()
  341.     sleep(0.1)
  342.     mInit()
  343.     page3()
  344.     sleep(0.1)
  345.     mInit()
  346.     page2()
  347.     sleep(0.1)
  348.     mInit()
  349.     page1()
  350.     sleep(0.1)
  351.   end  
  352.  
  353. -- PAGES - END
  354. -- ##########################
  355.  
  356. -- ##########################
  357. -- SCENES -- BEGIN
  358.  
  359.   function scene1()
  360.     leftRight()
  361.     rightLeft()  
  362.     leftRight()
  363.     rightLeft()
  364.     leftRight()
  365.     rightLeft()  
  366.     leftRight()
  367.     rightLeft()
  368.   end
  369.  
  370. -- SCENES -- END
  371. -- ##########################
  372.  
  373. -- the program function
  374. function program()
  375.  
  376. -- ##########################
  377. -- PROGRAM OUTPUT - BEGIN
  378.  
  379.   clearTerm()
  380.   termCursor(1,1)
  381.   writeTerm("Program Running")
  382.   term_nl()
  383.  
  384.   while true do
  385.     scene1()
  386.   end
  387.  
  388. -- Test Output to Monitor
  389. --  monitorWrite("Monitor write completed")
  390. --  nl()
  391. --  monCenterText("Centered Text")
  392. --  nl()
  393.  
  394. -- Test output to Terminal
  395. --  writeTerm("Terminal write completed")
  396. --  term_nl()
  397.  
  398. -- PROGRAM OUTPUT - END
  399. -- ##########################
  400. end
  401.  
  402. -- FUNCTIONS -- END
  403. -- ##########################
  404.  
  405. -- ############################################################
  406. -- ############################################################
  407.  
  408.  
  409. -- ##########################
  410. -- SEQUENCE -- BEGIN
  411.  
  412. mInit()
  413. program()
  414.  
  415.  
  416. -- SEQUENCE -- END
  417. -- ##########################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement