SHOW:
|
|
- or go back to the newest paste.
| 1 | os.loadAPI("button")
| |
| 2 | local m = peripheral.wrap("monitor_0")
| |
| 3 | ||
| 4 | ||
| 5 | - | function newTouchMenu() |
| 5 | + | Bottom = Grinder |
| 6 | Top = Lights | |
| 7 | - | m.setBackgroundColor(colors.black) |
| 7 | + | Left = MobSpawner |
| 8 | - | m.setTextColor(colors.white) |
| 8 | + | |
| 9 | ||
| 10 | ||
| 11 | - | |
| 11 | + | local function default() |
| 12 | - | function fillTable() |
| 12 | + | rs.setOutput("left", true)
|
| 13 | - | newTouchMenu() |
| 13 | + | |
| 14 | - | button.clearTable() |
| 14 | + | rs.setOutput("bottom", false)
|
| 15 | - | button.setTable("HouseControl", houseControl, 4,26 ,3,6)
|
| 15 | + | button.toggleButton("Grinder")
|
| 16 | - | button.setTable("N/A", na, 4,26 ,9,12)
|
| 16 | + | |
| 17 | - | button.setTable("N/A2", na2, 4,26 ,14,17)
|
| 17 | + | rs.setOutput("top", false)
|
| 18 | - | button.setTable("Menu", mainMenu, 2,28, 19,20)
|
| 18 | + | |
| 19 | - | print("Main Menu Filled")
|
| 19 | + | |
| 20 | - | button.screen() |
| 20 | + | function menu() |
| 21 | - | end |
| 21 | + | |
| 22 | button.setTable("Lights", lights, 4,26 ,2,6)
| |
| 23 | - | function houseControl() |
| 23 | + | button.setTable("Grinder", grinder, 4,26 ,8,12)
|
| 24 | - | button.flash("HouseControl")
|
| 24 | + | button.setTable("Spawner", spawner, 4,26 ,14,17)
|
| 25 | - | newTouchMenu() |
| 25 | + | button.setTable("Reboot", reboot, 2,28, 19,20)
|
| 26 | - | button.clearTable() |
| 26 | + | |
| 27 | - | button.setTable("Obsidian Collection", oC, 4,26 ,2,6)
|
| 27 | + | default() |
| 28 | - | button.setTable("Energy Status", energyStatus, 4,26 ,8,12)
|
| 28 | + | |
| 29 | - | button.setTable("Menu", mainMenu, 2,28, 19,20)
|
| 29 | + | |
| 30 | - | button.setTable("N/A", na, 4,26 ,14,17)
|
| 30 | + | function reboot() |
| 31 | - | print("House Control Filled")
|
| 31 | + | os.reboot() |
| 32 | end | |
| 33 | ||
| 34 | function grinder() | |
| 35 | - | function na() |
| 35 | + | if rs.getOutput("bottom")
|
| 36 | - | button.flash("N/A")
|
| 36 | + | then grinderOn() else grinderOff() |
| 37 | - | print("I do nothing; Hurray!")
|
| 37 | + | |
| 38 | end | |
| 39 | ||
| 40 | - | function na2() |
| 40 | + | function spawner() |
| 41 | - | button.flash("N/A2")
|
| 41 | + | if rs.getOutput("left")
|
| 42 | - | print("I do nothing 2; Hurray!")
|
| 42 | + | then spawnerOn() else spawnerOff() |
| 43 | end | |
| 44 | end | |
| 45 | - | function oC() |
| 45 | + | |
| 46 | - | button.toggleButton("Obsidian Collection")
|
| 46 | + | function lights() |
| 47 | - | rednet.send(63, "oc") |
| 47 | + | if rs.getOutput("top") then
|
| 48 | lightsOn() else lightsOff() | |
| 49 | end | |
| 50 | - | function mainMenu() |
| 50 | + | |
| 51 | - | button.flash("Menu")
|
| 51 | + | |
| 52 | ||
| 53 | - | fillTable() |
| 53 | + | function lightsOn() |
| 54 | - | -- refresh() |
| 54 | + | rs.setOutput("top", false)
|
| 55 | button.toggleButton("Lights")
| |
| 56 | end | |
| 57 | ||
| 58 | - | function energyStatus() |
| 58 | + | function lightsOff() |
| 59 | - | button.flash("Energy Status")
|
| 59 | + | rs.setOutput("top", true)
|
| 60 | button.toggleButton("Lights")
| |
| 61 | - | sleep(.1) |
| 61 | + | |
| 62 | - | m.setCursorPos(6,10) |
| 62 | + | |
| 63 | - | m.setTextScale(1) |
| 63 | + | |
| 64 | - | m.setTextColor(colors.white) |
| 64 | + | function grinderOn() |
| 65 | - | m.write("Loading Information")
|
| 65 | + | rs.setOutput("bottom", false)
|
| 66 | - | sleep(.5) |
| 66 | + | button.toggleButton("Grinder")
|
| 67 | end | |
| 68 | - | m.write("Loading Information.")
|
| 68 | + | |
| 69 | - | sleep(.5) |
| 69 | + | function grinderOff() |
| 70 | rs.setOutput("bottom", true)
| |
| 71 | - | m.write("Loading Information..")
|
| 71 | + | button.toggleButton("Grinder")
|
| 72 | - | sleep(.5) |
| 72 | + | |
| 73 | ||
| 74 | - | m.write("Loading Information...")
|
| 74 | + | |
| 75 | - | sleep(.5) |
| 75 | + | function spawnerOn() |
| 76 | rs.setOutput("left", false)
| |
| 77 | - | button.clearTable() |
| 77 | + | button.toggleButton("Spawner")
|
| 78 | - | button.setTable("Refresh", refresh, 2,28,0,2)
|
| 78 | + | activatorOn() |
| 79 | - | button.setTable("Menu", mainMenu, 2,28, 19,20)
|
| 79 | + | |
| 80 | ||
| 81 | - | m.setTextScale(1.4) |
| 81 | + | function spawnerOff() |
| 82 | - | m.setCursorPos(0,10) |
| 82 | + | rs.setOutput("left", true)
|
| 83 | - | button.centerText("Power : ..en")
|
| 83 | + | button.toggleButton("Spawner")
|
| 84 | - | m.setCursorPos(21,3) |
| 84 | + | activatorOff() |
| 85 | end | |
| 86 | ||
| 87 | ||
| 88 | - | function getPower() |
| 88 | + | function getClick() |
| 89 | - | c = peripheral.wrap("right")
|
| 89 | + | local event,side,x,y = os.pullEvent() |
| 90 | if event=="monitor_touch" then | |
| 91 | - | en = c.getEnergyStored("south")
|
| 91 | + | button.checkxy(x,y) |
| 92 | - | sleep(.1) |
| 92 | + | end |
| 93 | end | |
| 94 | ||
| 95 | ||
| 96 | menu() | |
| 97 | - | function lockScreen() |
| 97 | + | |
| 98 | while true do | |
| 99 | - | button.clearTable() |
| 99 | + | getClick() |
| 100 | - | m.setTextColor(colors.red) |
| 100 | + | end |