Guest User

Untitled

a guest
Dec 12th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.28 KB | None | 0 0
  1. local on = true
  2. local start = {"+---------------+",
  3. "| START-UP |",
  4. "+---------------+",
  5. "| LOG-IN |",
  6. "| REGISTER |",
  7. "+---------------+"}
  8.  
  9. local login = {"+---------------+",
  10. "| LOG-IN |",
  11. "+---------------+",
  12. "|USERNAME: ",
  13. "|PASSWORD: ",
  14. "+---------------+"}
  15.  
  16. local reg = {"+---------------+",
  17. "| REGISTER |",
  18. "+---------------+",
  19. "|USERNAME: ",
  20. ":PASSWORD: ",
  21. "+---------------+"}
  22.  
  23. local menu = {"+---------------+",
  24. "| MENU |",
  25. "+---------------+",
  26. "| EMAILS |",
  27. "| READ-EMAIL |",
  28. "| SEND-EMAIL |",
  29. "| LOGOUT |",
  30. "+---------------+"}
  31.  
  32. local ems = {"+---------------+",
  33. "| EMAILS |",
  34. "+---------------+"}
  35.  
  36. local send = {"+---------------+",
  37. "| SEND-EMAIL |",
  38. "+---------------+",
  39. "|TO: ",
  40. "+---------------+"}
  41.  
  42. local read = {"+---------------+",
  43. "| READ-EMAIL |",
  44. "+---------------+",
  45. "|FROM: ",
  46. "|NUMBER: ",
  47. "+---------------+"}
  48.  
  49. local cur = "start"
  50. local sec = 1
  51.  
  52. local curemail
  53.  
  54.  
  55.  
  56.  
  57. local function getMax(cur)
  58. if cur == "start" then
  59. return 2
  60. elseif cur == "login" then
  61. return 2
  62. elseif cur == "reg" then
  63. return 2
  64. elseif cur == "menu" then
  65. return 4
  66. elseif cur == "ems" then
  67. return 0
  68. elseif cur == "send" then
  69. return 1
  70. elseif cur == "read" then
  71. return 2
  72. else
  73. return 0
  74. end
  75. end
  76.  
  77. local function display(cur, selection)
  78. local data = nil
  79. local n = 0
  80. if cur == "start" then
  81. data = start
  82. if sec == 1 then
  83. data[4] = "| [LOG-IN] |"
  84. elseif sec == 2 then
  85. data[5] = "| [REGISTER] |"
  86. end
  87. elseif cur == "login" then
  88. data = login
  89. if sec == 1 then
  90. data[4] = "|[USERNAME]: "
  91. elseif sec == 2 then
  92. data[5] = "|[PASSWORD]: "
  93. end
  94. elseif cur == "reg" then
  95. data = reg
  96. if sec == 1 then
  97. data[4] = "|[USERNAME]: "
  98. elseif sec == 2 then
  99. data[5] = "|[PASSWORD]: "
  100. end
  101. elseif cur == "menu" then
  102. data = menu
  103. if sec == 1 then
  104. data[4] = "| [EMAILS] |"
  105. elseif sec == 2 then
  106. data[5] = "| [READ-EMAIL] |"
  107. elseif sec == 3 then
  108. data[6] = "| [SEND-EMAIL] |"
  109. elseif sec == 4 then
  110. data[7] = "| [LOGOUT] |"
  111. end
  112. elseif cur == "ems" then
  113. data = ems
  114. elseif cur == "send" then
  115. data = send
  116. if sec == 1 then
  117. data[4] = "|[TO]: "
  118. end
  119. elseif cur == "read" then
  120. data = read
  121. if sec == 1 then
  122. data[4] = "|[FROM]: "
  123. elseif sec == 2 then
  124. data[5] = "|[NUMBER]: "
  125. end
  126. end
  127.  
  128. if data ~= nil then
  129. for i,v in ipairs(data) do
  130. print(v)
  131. end
  132. elseif curemail ~= nil then
  133. for i,v in ipairs(curemail) do
  134. print(v)
  135. end
  136. else
  137. on = false
  138. end
  139. end
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148. while on do
  149. term.clear()
  150. term.setCursorPos(1,1)
  151. display(cur, sec)
  152.  
  153. if cur == "reading" then
  154. term.setCursorPos(1,1)
  155. end
  156.  
  157. if cur == "writing" then
  158.  
  159. end
  160.  
  161. event, key = os.pullEvent()
  162. while key == nil do
  163. event, key = os.pullEvent()
  164. end
  165.  
  166. if key ==
  167. sleep(1)
  168. end
  169.  
  170. term.clear()
  171. term.setCursorPos(1,1)
Add Comment
Please, Sign In to add comment