Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Random quests pop up on message app
- --Achievements / collectables app
- --Radar app
- --Note pad (quest log)
- --Put functions in a table and change apps that way
- term.clear()
- local width,height = term.getSize()
- local function newButton(xStart,yStart,label)
- term.setCursorPos(xStart,yStart)
- term.write("["..label.."]")
- local xEnd,yEnd = term.getCursorPos()
- return {xStart, yStart, xEnd, yEnd, label}
- end
- local function waitButtonPressed(list) --Returns index # of button pressed from button press
- local event, button, x, y = os.pullEvent( "mouse_click" )
- for i = 1, #list do
- if x >= list[i][1] and x <= list[i][3] and y >= list[i][2] and y <= list[i][4] then
- return list[i][5]
- end
- end
- return false
- end
- local function setRadarScreen()
- term.clear()
- while true do
- local bList = { newButton(1,1,"Main"), newButton(1,2,"Set Frequency") }
- local bChoice = waitButtonPressed(bList)
- while bChoice == false do
- bChoice = waitButtonPressed(bList)
- end
- if bChoice == "Set Frequency" then
- term.setCursorPos(1,height*0.5)
- term.clear()
- term.write("Hahaha loser >:)")
- elseif bChoice == "Main" then
- return "Main"
- else
- term.setCursorPos(1,height*0.5)
- term.write("Uknown input")
- end
- end
- end
- local function setMessageScreen()
- term.clear()
- while true do
- local bList = { newButton(1,1,"Main") }
- term.setCursorPos(1,2)
- print("Inbox:")
- print("from: Tutorial bot { Hello! Please read me' }")
- print("from: Uknown { 'Hot single robots near you'}")
- bChoice = waitButtonPressed(bList)
- while bChoice == false do
- bChoice = waitButtonPressed(bList)
- end
- if bChoice == "Main" then
- return "Main"
- end
- end
- end
- local function setMainScreen()
- term.clear()
- while true do
- local bList = { newButton(1,1,"Radar"), newButton(1,2,"Achievements"), newButton(1,3,"Messages") }
- local bChoice = waitButtonPressed(bList)
- while bChoice == false do
- bChoice = waitButtonPressed(bList)
- end
- if bChoice == "Radar" then
- return "Radar"
- elseif bChoice == "Achievements" then
- return "Achievements"
- elseif bChoice == "Messages" then
- return "Messages"
- else
- return false
- end
- end
- end
- local function setAchievenemtScreen()
- term.clear()
- while true do
- local bList = { newButton(1,1,"Main") }
- term.setCursorPos(1,2)
- print("Achievements:")
- print("Are are currently a loser with")
- print("nothing notable about you. Great")
- print("job, bud.")
- local bChoice = waitButtonPressed(bList)
- while bChoice == false do
- bChoice = waitButtonPressed(bList)
- end
- if bChoice == "Main" then
- return "Main"
- end
- end
- end
- local targetFrequency = 100
- local bChoice = setMainScreen()
- while true do
- if bChoice == "Main" then
- bChoice = setMainScreen()
- elseif bChoice == "Achievements" then
- bChoice = setAchievenemtScreen()
- elseif bChoice == "Radar" then
- bChoice = setRadarScreen()
- elseif bChoice == "Messages" then
- bChoice = setMessageScreen()
- elseif bChoice == "Notes" then
- bChoice = setNoteScreen()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement