Advertisement
colhaydutu

testtttt

Sep 9th, 2023 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. local monitor = peripheral.wrap("front")
  2.  
  3.  
  4. local function drawBar()
  5. monitor.clear()
  6. local w, h = monitor.getSize()
  7. term.redirect(monitor)
  8.  
  9. paintutils.drawFilledBox(1,1,8,7,colors.green)
  10. paintutils.drawFilledBox(8,7,10,14,colors.red)
  11. paintutils.drawLine(9,1,9,10, colors.gray)
  12.  
  13. monitor.setCursorPos(2,3)
  14. monitor.setBackgroundColor(colors.green)
  15. monitor.setTextColor(colors.white)
  16. monitor.write("[Open]")
  17.  
  18. monitor.setCursorPos(11,3)
  19. monitor.setBackgroundColor(colors.red)
  20. monitor.setTextColor(colors.white)
  21. monitor.write("[Close]")
  22.  
  23. end
  24.  
  25. drawBar()
  26.  
  27. while true do
  28. local event, side, x, y = os.pullEvent("monitor_touch")
  29.  
  30. if x >= 2 and x <= 6 and y == 3 then
  31. monitor.clear()
  32. monitor.setTextColor(colors.white)
  33. monitor.setCursorPos(2,3)
  34. monitor.write("Door is open")
  35. monitor.setCursorPos(2,4)
  36. monitor.write("Please wait")
  37. ---------------------------------
  38. --place redstone code
  39.  
  40. -----------------------------------
  41.  
  42. elseif x >= 11 and x <= 14 and y == 3 then
  43. monitor.clear()
  44. monitor.setTextColor(colors.white)
  45. monitor.setCursorPos(2,3)
  46. monitor.write("Door is close")
  47. monitor.setCursorPos(2,4)
  48. monitor.write("Please wait")
  49.  
  50. ---------------------------------
  51. --place redstone code
  52.  
  53. -----------------------------------
  54.  
  55. end
  56.  
  57. drawBar()
  58. end
  59.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement