Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- local x, y = 1,4
- local x2, y2 = 1,6
- local x3, y3 = 1,8
- local x4, y4 = 1,10
- local x5, y5 = 1,12
- local x6, y6 = 1,14
- local choice1 = "[ ] Menu "
- local choice2 = "[ ] Remote "
- local choice3 = "[ ] Rename "
- local choice4 = "[ ] Refuel "
- local choice5 = "[ ] Restart "
- local choice6 = "[ ] Shutdown "
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.lightGray)
- print("--------------------------")
- print("---")
- term.setTextColor(colors.lightBlue)
- term.setCursorPos(4, 2)
- print("Bubble Bot Computers")
- term.setTextColor(colors.lightGray)
- term.setCursorPos(24, 2)
- print("---")
- print("--------------------------")
- local function drawMenu()
- sleep(.1)
- term.setCursorPos(x, y)
- term.setTextColor(colors.white)
- write(choice1)
- term.setCursorPos(x2, y2)
- write(choice2)
- term.setCursorPos(x3, y3)
- write(choice3)
- term.setCursorPos(x4, y4)
- write(choice4)
- term.setCursorPos(x5, y5)
- write(choice5)
- term.setCursorPos(x6, y6)
- write(choice6)
- end
- drawMenu()
- while true do
- local event, button, cx, cy = os.pullEvent()
- if event == "mouse_click" then
- if cx >= x and cx < choice1:len() and cy == y and button == 1 then
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.white)
- shell.run("menu")
- elseif cx >= x2 and cx < choice2:len() and cy == y2 and button == 1 then
- term.clear()
- term.setCursorPos(1, 1)
- term.setTextColor(colors.white)
- shell.run("remote")
- elseif cx >= x3 and cx < choice3:len() and cy == y3 and button == 1 then
- rednet.broadcast("TurtleName")
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- print("Name:")
- term.setCursorPos(6, 1)
- input = read()
- sleep(3)
- rednet.broadcast(input)
- sleep(2.5)
- shell.run("turtlemenu")
- elseif cx >= x4 and cx < choice3:len() and cy == y4 and button == 1 then
- rednet.broadcast("TS Refuel")
- sleep(.1)
- shell.run("turtlemenu")
- elseif cx >= x5 and cx < choice3:len() and cy == y5 and button == 1 then
- rednet.broadcast("TurtleRestart")
- elseif cx >= x6 and cx < choice3:len() and cy == y6 and button == 1 then
- rednet.broadcast("TurtleShutdown")
- sleep(1)
- shell.run("menu")
- end
- break
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement