Advertisement
nicokno

test1

Aug 21st, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. monitor = peripheral.wrap("back","front")
  2.  
  3. monitor.clear()
  4.  
  5. monitor.setBackgroundColor(colors.blue)
  6. monitor.setCursorPos(3,2)
  7. monitor.write(string.rep(" ", 10))
  8.  
  9. monitor.setTextColor(colors.white)
  10. monitor.setCursorPos(3+2,2)
  11. monitor.write("Abrir")
  12.  
  13. monitor.setBackgroundColor(colors.black)
  14. monitor.setTextColor(colors.white)
  15.  
  16. function Abrir ()
  17.  
  18. monitor.clear()
  19.  
  20. monitor.setBackgroundColor(colors.red)
  21. monitor.setCursorPos(3,2)
  22. monitor.write(string.rep(" ", 10))
  23.  
  24. monitor.setTextColor(colors.white)
  25. monitor.setCursorPos(3+2,2)
  26. monitor.write("Cerrar")
  27.  
  28. monitor.setBackgroundColor(colors.black)
  29. monitor.setTextColor(colors.white)
  30.  
  31. redstone.setOutput("bottom", true)
  32. end
  33.  
  34. function Cerrar ()
  35. monitor.clear()
  36.  
  37. monitor.setBackgroundColor(colors.blue)
  38. monitor.setCursorPos(3,2)
  39. monitor.write(string.rep(" ", 10))
  40.  
  41. monitor.setTextColor(colors.white)
  42. monitor.setCursorPos(3+2,2)
  43. monitor.write("Abrir")
  44.  
  45. monitor.setBackgroundColor(colors.black)
  46. monitor.setTextColor(colors.white)
  47.  
  48. redstone.setOutput("bottom", false)
  49. end
  50.  
  51. while true do
  52. event, side, xPos, yPos = os.pullEvent("monitor_touch")
  53.  
  54. if (xPos >= 3) and (xPos <= 12) and (yPos == 2) then
  55. if (redstone.getInput("back")) then
  56. Cerrar()
  57. else
  58. Abrir()
  59. end
  60. end
  61.  
  62. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement