Nike622000

Untitled

May 6th, 2016
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.46 KB | None | 0 0
  1. local monitorside = "back"
  2. mon = peripheral.wrap(monitorside)
  3. local x,y = mon.getSize()
  4.  
  5. function Background()
  6. for i=1,y do
  7. mon.setCursorPos(1,i)
  8. mon.setBackgroundColor(colors.white)
  9. for j=1,x do
  10. mon.write(" ")
  11. end
  12. end
  13. end
  14.  
  15. function bdraw(xp1,yp1,xp2,yp2,txt,col)
  16. if col==nil then
  17. mon.setBackgroundColor(colors.lime)
  18. else
  19. mon.setBackgroundColor(col)
  20. end
  21. mon.setCursorPos(xp1,yp1)
  22. for i=1,(xp2-xp1) do
  23. mon.write("-")
  24. end
  25. mon.setCursorPos(xp1,yp2)
  26. for i=1,(xp2-xp1) do
  27. mon.write("-")
  28. end
  29. for i=yp1,yp2 do
  30. mon.setCursorPos(xp1,i)
  31. mon.write("|")
  32. mon.setCursorPos(xp2,i)
  33. mon.write("|")
  34. end
  35. for i=(yp1+1),(yp2-1) do
  36. mon.setCursorPos((xp1+1),i)
  37. for j=(xp1+1),(xp2-1) do
  38. mon.write(" ")
  39. j = j+1
  40. end
  41. i = i+1
  42. end
  43. if math.floor(((xp2-xp1)-#txt)/2)==0 then
  44. xp1 = xp1+1
  45. end
  46. mon.setCursorPos(math.floor(((xp2-xp1)-#txt)/2)+xp1,math.floor((yp2-yp1)/2)+yp1)
  47. print(math.floor(((xp2-xp1)-#txt)/2))
  48. mon.write(txt)
  49. end
  50.  
  51. Background()
  52. mon.setTextColor(colors.black)
  53. mon.setCursorPos(13,1)
  54. mon.write("Haussteuerung")
  55. mon.setTextColor(colors.blue)
  56. mon.setCursorPos(1,3)
  57. mon.write("Automatische Erzschmelze: ")
  58. mon.setCursorPos(1,4)
  59. mon.write("Mass Fabricator: ")
  60. mon.setCursorPos(1,5)
  61. mon.write("Crystallizer: ")
  62. mon.setCursorPos(1,6)
  63. mon.setTextColor(colors.black)
  64. mon.write("---------------------------------------")
  65. mon.setCursorPos(1,8)
  66. mon.setTextColor(colors.cyan)
  67. mon.write("Haustuer: ")
  68. mon.setCursorPos(1,9)
  69. mon.setTextColor(colors.black)
  70. mon.write("---------------------------------------")
  71.  
  72. while true do
  73. if rs.testBundledInput("front", colors.green) then
  74. mon.setCursorPos(26,3)
  75. mon.setTextColor(colors.lime)
  76. mon.write("(AN) ")
  77. else
  78. mon.setCursorPos(26,3)
  79. mon.setTextColor(colors.red)
  80. mon.write("(AUS)")
  81. end
  82. if rs.testBundledInput("front", colors.red) then
  83. mon.setCursorPos(26,4)
  84. mon.setTextColor(colors.lime)
  85. mon.write("(AN) ")
  86. else
  87. mon.setCursorPos(26,4)
  88. mon.setTextColor(colors.red)
  89. mon.write("(AUS)")
  90. end
  91. if rs.testBundledInput("front", colors.blue) then
  92. mon.setCursorPos(31,4)
  93. mon.setTextColor(colors.orange)
  94. mon.write("(Tag) ")
  95. else
  96. mon.setCursorPos(31,4)
  97. mon.setTextColor(colors.black)
  98. mon.write("(Nacht)")
  99. end
  100. if rs.testBundledInput("front", colors.brown) then
  101. mon.setCursorPos(26,5)
  102. mon.setTextColor(colors.lime)
  103. mon.write("(AN) ")
  104. else
  105. mon.setCursorPos(26,5)
  106. mon.setTextColor(colors.red)
  107. mon.write("(AUS)")
  108. end
  109. if rs.testBundledInput("front", colors.purple) then
  110. mon.setCursorPos(26,8)
  111. mon.setTextColor(colors.lime)
  112. mon.write("(AUF)")
  113. else
  114. mon.setCursorPos(26,8)
  115. mon.setTextColor(colors.red)
  116. mon.write("(ZU) ")
  117. end
  118. if rs.testBundledInput("front",colors.yellow) then
  119. mon.setCursorPos(31,8)
  120. mon.setTextColor(colors.orange)
  121. mon.write("(Klingel)")
  122. sleep(0.5)
  123. mon.setCursorPos(31,8)
  124. mon.write(" ")
  125. sleep(0.5)
  126. mon.setCursorPos(31,8)
  127. mon.write("(Klingel)")
  128. mon.setCursorPos(31,8)
  129. sleep(0.5)
  130. mon.write(" ")
  131. mon.setCursorPos(31,8)
  132. sleep(0.5)
  133. mon.write("(Klingel)")
  134. sleep(0.5)
  135. mon.setCursorPos(31,8)
  136. mon.write(" ")
  137. end
  138. mon.setCursorPos(1,9)
  139. mon.setTextColor(colors.black)
  140. mon.write("---------------------------------------")
  141.  
  142. mon.setTextColor(colors.white)
  143. bdraw(x-8,y-2,x,y,"zurueck",colors.red)
  144. event,_,xPos,yPos = os.pullEvent()
  145. mon.setBackgroundColor(colors.white)
  146.  
  147. if event=="monitor_touch" then
  148. if xPos>=x-8 and xPos<=x and yPos>=y-2 and yPos<=y then
  149. os.reboot()
  150. end
  151. end
  152. end
Advertisement
Add Comment
Please, Sign In to add comment