Advertisement
rhys19

Untitled

Jun 12th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. dofile("gui.lua")
  2.  
  3. gui.debug = false
  4.  
  5. local s = gui.screen()
  6. s:setBackgroundColor(colors.white)
  7.  
  8. local b = s:add(gui.button("X"))
  9. b:setTextColor(colors.black)
  10. b:setBackgroundColor(colors.red)
  11. b:setPosition(-1, 1)
  12. b:onClick(function(button, frame, event, x, y)
  13. frame:getScreen():stop()
  14. os.reboot()
  15. end)
  16.  
  17. local f = s:frame() -- includes add
  18. f:setPositions(3, 3, -3, -3)
  19. f:setTextColor(colors.black)
  20. f:setBackgroundColor(colors.green)
  21.  
  22. local t = gui.text("Open Gate");
  23. f:add(t)
  24.  
  25. local t = gui.text("Close Gate");
  26. f:add(t)
  27.  
  28. local menu = f:frame()
  29. menu:setPosition(-8, 11)
  30. menu:setSize(8, 10)
  31. menu.hide = true
  32. menu:setTextColor(colors.black)
  33. menu:setBackgroundColor(colors.lime)
  34. menu:add(gui.text("Close Gate"))
  35.  
  36. local m = f:add(gui.button("Open Gate"))
  37. m:setTextColor(colors.black)
  38. m:setBackgroundColor(colors.gray)
  39. m:setPosition(-1, -1, "right")
  40. m:onClick(function(button, frame, event, x, y)
  41. while true do --Will loop forever
  42. rs.setOutput("left", true) --Set the redstone output to the specified side to true
  43. sleep(60) -- wait 60 seconds
  44. rs.setOutput("left", false) --Set it to false
  45. sleep(60*5) -- sleep for 5 minutes
  46. end
  47. menu.hide = not menu.hide
  48. frame:getScreen():draw()
  49. end)
  50.  
  51. local m = f:add(gui.button("Close Gate"))
  52. m:setTextColor(colors.black)
  53. m:setBackgroundColor(colors.gray)
  54. m:setPosition(-1, -1, "right")
  55. m:onClick(function(button, frame, event, x, y)
  56. while true do --Will loop forever
  57. rs.setOutput("left", true) --Set the redstone output to the specified side to true
  58. sleep(60) -- wait 60 seconds
  59. rs.setOutput("left", false) --Set it to false
  60. sleep(60*5) -- sleep for 5 minutes
  61. end
  62. menu.hide = not menu.hide
  63. frame:getScreen():draw()
  64. end)
  65.  
  66. s:draw()
  67. s:wait()
  68. s:reset()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement