Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- os.loadAPI("touchpoint")
- rednet.open("bottom")
- local page1 = touchpoint.new("top")
- local page2 = touchpoint.new("top")
- local page3 = touchpoint.new("top")
- local page4 = touchpoint.new("top")
- local page5 = touchpoint.new("top")
- local t
- function turtleMsg(name, extra)
- extra = extra or nil
- if extra ~= nil then
- if extra == "fuelLevel" then
- rednet.send(3, tostring(name))
- local id, msg, dst = rednet.receive()
- page4:rename("Fuel Level", tostring(msg))
- t = page4
- t:draw()
- os.sleep(1.75)
- page4:rename(tostring(msg), "Fuel Level")
- t = page3
- t:draw()
- else
- rednet.send(3, tostring(name))
- local id, msg, dst = rednet.receive()
- page5:rename("Refueled", (tostring(msg)))
- t = page5
- t:draw()
- os.sleep(1.5)
- page5:rename((tostring(msg)), "Refueled")
- t = page3
- t:draw()
- end
- else
- page3:toggleButton(name)
- rednet.send(3, tostring(name))
- os.sleep(.75)
- page3:toggleButton(name)
- end
- end
- function rsRight()
- page2:toggleButton("Activate Right")
- rs.setOutput("right", not rs.getOutput("right"))
- end
- function rsLeft()
- page2:toggleButton("Activate Left")
- rs.setOutput("left", not rs.getOutput("left"))
- end
- function redMenu()
- t = page2
- end
- function mainMenu()
- t = page1
- end
- function turtleMenu()
- t = page3
- end
- function callButton(name)
- if t.buttonList[name].func ~= nil then
- t.buttonList[name].func()
- end
- end
- do
- page1:add("Main Menu", nil, 15, 35, 2, 5, colors.black, colors.black)
- page1:add("Redstone",redMenu, 5, 20, 11, 14)
- page1:add("Turtle",turtleMenu, 30, 45, 11, 14)
- page2:add("Activate Left", rsLeft, 5, 20, 11, 14)
- page2:add("Activate Right", rsRight, 30, 45, 11, 14)
- page2:add("Secret", wireless, 20, 30, 18, 21)
- page2:add("Main Menu",mainMenu, 15, 35, 3, 6)
- page3:add("Go Forward",function() turtleMsg("Go Forward") end, 5, 20, 11, 14)
- page3:add("Dig",function() turtleMsg("Dig") end, 30, 45, 11, 14)
- page3:add("Turn Left",function() turtleMsg("Turn Left") end, 5, 20, 16, 19)
- page3:add("Turn Right",function() turtleMsg("Turn Right") end, 30, 45, 16, 19)
- page3:add("Get Fuel Level", function() turtleMsg("Get Fuel Amount", "fuelLevel") end, 5, 20, 21, 24)
- page3:add("Refuel", function() turtleMsg("Refuel", "extraRefuel") end, 30, 45, 21, 24)
- page3:add("Main Menu",mainMenu, 15, 35, 3, 6)
- page4:add("Fuel Level", nil, 15, 35, 13, 16, colors.black, colors.black)
- page5:add("Refueled", nil, 5, 45, 13, 16, colors.black, colors.black)
- end
- t = page1
- while true do
- t:draw()
- local event, p1 = t:handleEvents(os.pullEvent())
- if event == "button_click" then
- callButton(p1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement