Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- local page1 = touchpoint.new("top")
- local page2 = touchpoint.new("monitor_5")
- page1:add("Open!", nil, 1, 1, 5, 5, colors.lime, colors.red)
- page2:add("Open!", nil, 1, 1, 5, 5, colors.lime, colors.red)
- --toggle buttons on both screens and activate redstone.
- function tog()
- page1:toggleButton()
- page2:toggleButton()
- rs.setOutput("back", true)
- sleep(1) --to give time for redstone to finish action
- rs.setOutput("back", false)
- end
- --activate tog() on button click.
- while true do
- page1:draw()
- page2:draw()
- local event, p1 = page1:handleEvents(page2:handleEvents(os.pullEvent()))
- if event == "button click" then
- tog()
- if p1 == "Open!" then --rename the buttons on click
- page1:rename("Open!", "Closed!")
- page2:rename("Open!", "Closed!")
- elseif p1 == "Closed!" then
- page1:rename("Closed!", "Open!")
- page2:rename("Closed!", "Open!")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement