Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("button")
- m = peripheral.wrap("back")
- wr = peripheral.wrap("right")
- local switches={}
- redstone.setBundledOutput("bottom",0)
- m.setTextScale(0.5)
- m.clear()
- --Design--
- term.setCursorPos(1,5)
- print("-------")
- term.setCursorPos(8,1)
- print("|")
- term.setCursorPos(8,2)
- print("|")
- term.setCursorPos(8,3)
- print("|")
- term.setCursorPos(8,4)
- print("|")
- term.setCursorPos(8,5)
- print("|")
- term.setCursorPos(8,6)
- print("|")
- term.setCursorPos(8,7)
- print("|")
- term.setCursorPos(8,8)
- print("|")
- term.setCursorPos(8,9)
- print("|")
- --Buttons--
- function mainTable()
- button.clearTable()
- button.setTable("UP" , up , 2,6,2,3)
- button.setTable("DOWN", down, 2,6,7,8)
- button.setTable("Haus", haus, 10,14,2,2)
- --button.setTable("1.UG", 1ug , 10,14,4,4)
- --button.setTable("2.UG", 2ug , 10,14,6,6)
- --button.setTable("3.UG", 3ug , 10,14,8,8)
- button.screen()
- end
- --Signals--
- function switch(name, colr)
- if switches[name] then
- redstone.setBundledOutput("bottom", redstone.getBundledOutput("bottom") - colr)
- else
- redstone.setBundledOutput("bottom", redstone.getBundledOutput("bottom") + colr)
- end
- switches[name] = not switches[name]
- end
- function up()
- switch("UP", colors.orange)
- button.toggleButton("UP")
- sleep(2)
- switch("UP", colors.orange)
- button.toggleButton("UP")
- end
- function down()
- switch("DOWN", colors.black)
- button.toggleButton("DOWN")
- sleep(2)
- switch("DOWN", colors.black)
- button.toggleButton("DOWN")
- end
- function haus()
- switch("Haus", colors.pink)
- button.toggleButton("Haus")
- sleep(2)
- switch("Haus", colors.pink)
- button.toggleButton("Haus")
- end
- function getclick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- while true do
- mainTable()
- getclick()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement