Nike622000

Untitled

May 6th, 2016
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 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("ME-Systeme")
  55. mon.setTextColor(colors.blue)
  56. mon.setCursorPos(1,3)
  57. mon.write("ME-Home System: ")
  58. mon.setCursorPos(1,4)
  59. mon.write("ME Notstrom: ")
  60. mon.setCursorPos(1,5)
  61. mon.setTextColor(colors.black)
  62. mon.write("---------------------------------------")
  63.  
  64. while true do
  65. if rs.testBundledInput("front", colors.red) then
  66. mon.setCursorPos(26,3)
  67. mon.setTextColor(colors.cyan)
  68. mon.write("(AUS)")
  69. else
  70. mon.setCursorPos(26,3)
  71. mon.setTextColor(colors.red)
  72. mon.write("(AN) ")
  73. end
  74. if rs.testBundledInput("front", colors.cyan) then
  75. mon.setCursorPos(26,4)
  76. mon.setTextColor(colors.lime)
  77. mon.write("(AUS)")
  78. else
  79. mon.setCursorPos(26,4)
  80. mon.setTextColor(colors.red)
  81. mon.write("(AN) ")
  82. end
  83.  
  84. mon.setTextColor(colors.white)
  85. bdraw(x-8,y-2,x,y,"zurueck",colors.red)
  86. event,_,xPos,yPos = os.pullEvent()
  87. mon.setBackgroundColor(colors.white)
  88.  
  89. if event=="monitor_touch" then
  90. if xPos>=x-8 and xPos<=x and yPos>=y-2 and yPos<=y then
  91. shell.run("menu")
  92. end
  93. end
  94. end
Advertisement
Add Comment
Please, Sign In to add comment