funnybunnyofdoom

doorgui

Nov 2nd, 2019
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. --This program will include the APIs to
  2. --control doors using a touch screen
  3. --and to display the status of the keycard
  4.  
  5. controlSide = "left"
  6. displaySide = "right"
  7.  
  8. controlMonitor = peripheral.wrap(controlSide)
  9. displayMonitor = peripheral.wrap(displaySide)
  10.  
  11. cx,cy = controlMonitor.getSize()
  12. dx,dy = displayMonitor.getSize()
  13.  
  14. --create the display monitor bg
  15. function displaybg(mode)
  16.  
  17.  
  18. ebgcolor = colors.lightGray
  19. ebdcolor = colors.gray
  20. gbgcolor = colors.lime
  21. gbdcolor = colors.green
  22. rbgcolor = colors.pink
  23. rbdcolor = colors.red
  24. bgc = colors.black
  25. bdc = colors.gray
  26. txc = colors.white
  27. txt = " "
  28.  
  29. if mode == "good" then
  30. bgc = colors.lime
  31. bdc = colors.green
  32. txc = colors.black
  33. txt = "GOOD"
  34. else if mode == "deny"
  35. bgc = colors.pink
  36. bdc = colors.red
  37. txc = colors.black
  38. txt = "DENY"
  39. else
  40. bgc = colors.lightGray
  41. bdc = colors.gray
  42. txc = colors.white
  43. txt = "EMPTY"
  44. end
  45.  
  46. displayMonitor.setBackgroundColor(bdc)
  47. displayMonitor.clear()
  48. displayMonitor.setCursorPos(2,3)
  49. displayMonitor.setTextColor(txc)
  50. displayMonitor.write(txt)
  51. displayMonitor.setBackgroundColor(bgc)
  52. for i=0,dx,1 do
  53. displayMonitor.setCursorPos(i+1,1)
  54. displayMonitor.write(" ")
  55. end
  56. for i=0,dx,1 do
  57. displayMonitor.setCursorPos(i+1,dy)
  58. displayMonitor.write(" ")
  59. end
  60. for i=0,dy,1 do
  61. displayMonitor.setCursorPos(1,i+1)
  62. displayMonitor.write(" ")
  63. end
  64. for i=0,dy,1 do
  65. displayMonitor.setCursorPos(dx,i+1)
  66. displayMonitor.write(" ")
  67. end
  68.  
  69. displayMonitor.setBackgroundColor(colors.black)
  70. displayMonitor.setTextColor(colors.white)
  71. end
  72.  
  73. displaybg()
Add Comment
Please, Sign In to add comment