Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.83 KB | None | 0 0
  1. os.loadAPI("button")
  2. monitor = peripheral.wrap("top")
  3. modem = peripheral.wrap("right")
  4. modem.open(366)
  5.  
  6. function clear()
  7.   monitor.clear()
  8.   button.clearTable()
  9. end
  10.  
  11. function mainMenu()
  12.   button.flash("back")
  13.   clear()
  14.   monitor.setTextScale(1)
  15.   monitor.setCursorPos(1, 1)
  16.   monitor.setCursorPos(11, 1)
  17.   monitor.write("Main Menu")
  18.   button.setTable("Front Door", frontDoor, "", 2, 14, 3, 8)
  19.   button.setTable("Lights", lights, "", 16, 29, 3, 8)
  20.   button.screen()
  21. end
  22.  
  23. function frontDoor()
  24.   button.flash("Front Door")
  25.   clear()
  26.   monitor.setCursorPos(1, 1)
  27.   monitor.setCursorPos(11, 1)
  28.   monitor.write("Front door")
  29.   button.setTable("Open door", openDoor, "", 2, 13, 3, 12)
  30.   button.setTable("Close door", closeDoor, "", 17, 28, 3, 12)
  31.   button.setTable("Back", backMain, "", 1, 30, 18, 20)
  32.   button.screen()
  33. end
  34.  
  35. function lights()
  36.   button.flash("Lights")
  37.   clear()
  38.   monitor.setCursorPos(1, 1)
  39.   monitor.setCursorPos(11, 1)
  40.   monitor.write("Lights")
  41.   button.setTable("2F", lights2F, "", 2, 13, 3, 4)
  42.   button.setTable("1F", lights1F, "", 2, 13, 5, 6)
  43.   button.setTable("BF", lightsBF, "", 2, 13, 7, 9)
  44.   button.setTable("B1", lightsB1, "", 2, 13, 7, 9)
  45.   button.setTable("B2", lightsB2, "", 2, 13, 10,11)
  46.   button.setTable("Thaum", lightsThaum, "", 2, 13, 12, 13)
  47.   button.setTable("Back", backMain, "", 1, 30, 18, 20)
  48.   button.screen()
  49. end
  50.  
  51. function openDoor()
  52.   button.toggleButton("Open door")
  53.   modem.transmit(365, 366, "open")
  54.   sleep(12)
  55.   button.toggleButton("Open door")
  56. end
  57.  
  58. function closeDoor()
  59.   button.toggleButton("Close door")
  60.   modem.transmit(365, 366, "close")
  61.   sleep(14)
  62.   button.toggleButton("Close door")
  63. end
  64.  
  65. --[[ function backMain()
  66.   button.flash("back")
  67.   mainMenu()
  68. end ]]--
  69.  
  70. mainMenu()
  71.  
  72. while true do
  73.   local event, side, x, y = os.pullEvent()
  74.   button.checkxy(x,y)
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement