Advertisement
DevSDK

Untitled

May 29th, 2018
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.74 KB | None | 0 0
  1. --This program is used SPKPK management system
  2. --
  3. -- Copyright (c) 2018 Seokho Song
  4. --
  5. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  6. -- of this software and associated documentation files (the "Software"), to deal
  7. -- in the Software without restriction, including without limitation the rights
  8. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. -- copies of the Software, and to permit persons to whom the Software is
  10. -- furnished to do so, subject to the following conditions:
  11. --
  12. -- The above copyright notice and this permission notice shall be included in all
  13. -- copies or substantial portions of the Software.
  14. --
  15. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. -- SOFTWARE.
  22.  
  23.  
  24.  
  25. local monitor1 = peripheral.wrap("monitor_0")
  26.  
  27.  
  28. function newLine(monitor, offset)
  29. local cX,cY = monitor.getCursorPos()
  30. monitor.setCursorPos(offset,cY+1)
  31. end
  32.  
  33. function DrawDialog(monitor, offset)
  34. monitor.setCursorPos(offset, 1)
  35. monitor.write("#")
  36. newLine(monitor, offset)
  37. monitor.write("#")
  38. newLine(monitor, offset)
  39. monitor.write(" ")
  40. newLine(monitor, offset)
  41. monitor.write("#")
  42. newLine(monitor, offset)
  43. monitor.write("#")
  44. newLine(monitor, offset)
  45. end
  46.  
  47. function DrawLargeNumber(monitor, offset, number)
  48. monitor.setCursorPos(offset, 1)
  49. if number == 0 then
  50. monitor.write("#####")
  51. newLine(monitor, offset)
  52. monitor.write("# #")
  53. newLine(monitor, offset)
  54. monitor.write("# #")
  55. newLine(monitor, offset)
  56. monitor.write("# #")
  57. newLine(monitor, offset)
  58. monitor.write("#####")
  59. elseif number == 1 then
  60. monitor.write(" #")
  61. newLine(monitor, offset)
  62. monitor.write(" #")
  63. newLine(monitor, offset)
  64. monitor.write(" #")
  65. newLine(monitor, offset)
  66. monitor.write(" #")
  67. newLine(monitor, offset)
  68. monitor.write(" #")
  69. elseif number == 2 then
  70. monitor.write("#####")
  71. newLine(monitor, offset)
  72. monitor.write(" #")
  73. newLine(monitor, offset)
  74. monitor.write("#####")
  75. newLine(monitor, offset)
  76. monitor.write("# ")
  77. newLine(monitor, offset)
  78. monitor.write("#####")
  79. elseif number == 3 then
  80. monitor.write("#####")
  81. newLine(monitor, offset)
  82. monitor.write(" #")
  83. newLine(monitor, offset)
  84. monitor.write("#####")
  85. newLine(monitor, offset)
  86. monitor.write(" #")
  87. newLine(monitor, offset)
  88. monitor.write("#####")
  89. elseif number == 4 then
  90. monitor.write("# #")
  91. newLine(monitor, offset)
  92. monitor.write("# #")
  93. newLine(monitor, offset)
  94. monitor.write("#####")
  95. newLine(monitor, offset)
  96. monitor.write(" #")
  97. newLine(monitor, offset)
  98. monitor.write(" #")
  99. elseif number == 5 then
  100. monitor.write("#####")
  101. newLine(monitor, offset)
  102. monitor.write("# ")
  103. newLine(monitor, offset)
  104. monitor.write("#####")
  105. newLine(monitor, offset)
  106. monitor.write(" #")
  107. newLine(monitor, offset)
  108. monitor.write("#####")
  109. elseif number == 6 then
  110. monitor.write("# ")
  111. newLine(monitor, offset)
  112. monitor.write("# ")
  113. newLine(monitor, offset)
  114. monitor.write("#####")
  115. newLine(monitor, offset)
  116. monitor.write("# #")
  117. newLine(monitor, offset)
  118. monitor.write("#####")
  119. elseif number == 7 then
  120. monitor.write("#####")
  121. newLine(monitor, offset)
  122. monitor.write("# #")
  123. newLine(monitor, offset)
  124. monitor.write(" #")
  125. newLine(monitor, offset)
  126. monitor.write(" #")
  127. newLine(monitor, offset)
  128. monitor.write(" #")
  129. elseif number == 8 then
  130. monitor.write("#####")
  131. newLine(monitor, offset)
  132. monitor.write("# #")
  133. newLine(monitor, offset)
  134. monitor.write("#####")
  135. newLine(monitor, offset)
  136. monitor.write("# #")
  137. newLine(monitor, offset)
  138. monitor.write("#####")
  139. elseif number == 9 then
  140. monitor.write("#####")
  141. newLine(monitor, offset)
  142. monitor.write("# #")
  143. newLine(monitor, offset)
  144. monitor.write("#####")
  145. newLine(monitor, offset)
  146. monitor.write(" #")
  147. newLine(monitor, offset)
  148. monitor.write(" #")
  149. end
  150. end
  151.  
  152. function PrintTime(monitor)
  153. local time = os.time()
  154. local first = math.floor(time/10)
  155. local second = math.floor(time%10)
  156. local min = ((time*1000%1000 / 1000) * 60)
  157. local min_first = math.floor(min / 10)
  158. local min_second = math.floor(min % 10)
  159.  
  160. DrawLargeNumber(monitor, padding + 1, first)
  161. DrawLargeNumber(monitor,padding+ 7, second)
  162. DrawDialog(monitor, padding+ 13)
  163. DrawLargeNumber(monitor, padding + 15, min_first)
  164. DrawLargeNumber(monitor, padding+ 21, min_second)
  165. end
  166.  
  167. monitor1.setCursorPos(1,1)
  168. monitor1.clear()
  169. padding = 2
  170.  
  171.  
  172. pritn("The timer has been starting Press Ctrl + R to terminate program.")
  173.  
  174. while true do
  175. PrintTime(monitor1)
  176. os.sleep(0.5)
  177. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement