Advertisement
Nike622000

Untitled

May 8th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.14 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("Farmen: ")
  55. mon.setTextColor(colors.blue)
  56. mon.setCursorPos(1,3)
  57. mon.write("Weizenfarm: ")
  58. mon.setCursorPos(1,4)
  59. mon.write("Karottenfarm: ")
  60. mon.setCursorPos(1,5)
  61. mon.write("Kartoffelfarm: ")
  62. mon.setCursorPos(1,6)
  63. mon.write("Kakaobohnenfarm: ")
  64. mon.setCursorPos(1,7)
  65. mon.write("Flaxfarm: ")
  66. mon.setCursorPos(1,8)
  67. mon.write("Blumenfarm: ")
  68. mon.setCursorPos(1,9)
  69. mon.write("Netherwarzenfarm: ")
  70.  
  71. while true do
  72. if rs.testBundledInput("right", colors.green) then
  73. mon.setCursorPos(26,3)
  74. mon.setTextColor(colors.lime)
  75. mon.write("(AN) ")
  76. else
  77. mon.setCursorPos(26,3)
  78. mon.setTextColor(colors.red)
  79. mon.write("(AUS)")
  80. end
  81. if rs.testBundledInput("front", colors.black) then
  82. mon.setCursorPos(26,4)
  83. mon.setTextColor(colors.lime)
  84. mon.write("(AN) ")
  85. else
  86. mon.setCursorPos(26,4)
  87. mon.setTextColor(colors.red)
  88. mon.write("(AUS)")
  89. end
  90. if rs.testBundledInput("front", colors.brown) then
  91. mon.setCursorPos(26,5)
  92. mon.setTextColor(colors.blue)
  93. mon.write("(AN) ")
  94. else
  95. mon.setCursorPos(26,5)
  96. mon.setTextColor(colors.red)
  97. mon.write("(AUS)")
  98. end
  99. if rs.testBundledInput("front", colors.purple) then
  100. mon.setCursorPos(26,8)
  101. mon.setTextColor(colors.lime)
  102. mon.write("(AUF)")
  103. else
  104. mon.setCursorPos(26,8)
  105. mon.setTextColor(colors.red)
  106. mon.write("(ZU) ")
  107. end
  108. if rs.testBundledInput("front",colors.yellow) then
  109. mon.setCursorPos(31,8)
  110. mon.setTextColor(colors.orange)
  111. mon.write("(Klingel)")
  112. sleep(0.5)
  113. mon.setCursorPos(31,8)
  114. mon.write(" ")
  115. sleep(0.5)
  116. mon.setCursorPos(31,8)
  117. mon.write("(Klingel)")
  118. mon.setCursorPos(31,8)
  119. sleep(0.5)
  120. mon.write(" ")
  121. mon.setCursorPos(31,8)
  122. sleep(0.5)
  123. mon.write("(Klingel)")
  124. sleep(0.5)
  125. mon.setCursorPos(31,8)
  126. mon.write(" ")
  127. end
  128. mon.setCursorPos(1,9)
  129. mon.setTextColor(colors.black)
  130. mon.write("---------------------------------------")
  131.  
  132. mon.setTextColor(colors.white)
  133. bdraw(x-8,y-2,x,y,"zurueck",colors.red)
  134. event,_,xPos,yPos = os.pullEvent()
  135. mon.setBackgroundColor(colors.white)
  136.  
  137. if event=="monitor_touch" then
  138. if xPos>=x-8 and xPos<=x and yPos>=y-2 and yPos<=y then
  139. os.reboot()
  140. end
  141. end
  142. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement