Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Loads the API, straightforward
- os.loadAPI("touchpoint")
- --establish two "pages" of buttons
- local page1 = touchpoint.new("top")
- local page2 = touchpoint.new("top")
- --one variable to put each page into in order to simplify switching
- local t
- --Two redstone testing functions
- --add toggling where it makes sense
- function rsRight()
- page1:toggleButton("Activate Right")
- rs.setOutput("right", not rs.getOutput("right"))
- end
- function rsLeft()
- page1:toggleButton("Activate Left")
- rs.setOutput("left", not rs.getOutput("left"))
- end
- --Redstone, switch out
- function redMenu()
- t = page2
- end
- ---Main Menu
- function mainTable()
- t = page1
- end
- --set up two pages
- do
- page1:add("Redstone", redMenu, 5, 2, 20, 6)
- page1:add("Turtle",function() turtleMenu() end, 25, 2, 40, 6)
- page2:add("Activate Left", rsLeft, 5, 12, 20, 16)
- page2:add("Activate Right", rsRight, 25, 12, 40, 16)
- page2:add("Back",mainTable, 15, 18, 25, 22)
- end
- --Starts with the main Table, then checks for buttons clicked, toggles them, and runs the program it has with my modified t:run2()
- mainTable()
- while true do
- t:draw()
- -- local event, p1, p2, p3 = os.pullEvent() ---monitor_touch, side, xpos, ypos
- local event, p1 = t:handleEvents(os.pullEvent()) ---button_click, name
- if event == "button_click" then
- --remove toggling and simplify button running
- t.buttonList[p1].func()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement