Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- portals = {}
- portals[1] = { "Ground Floor" , "1-1-1" }
- portals[2] = { "Floor 1 - ME Control Room" , "0-0-0" }
- portals[3] = { "Floor 2 - Utilities Factory" , "3-3-3" }
- portals[4] = { "Floor 3 - Ingot Processing" , "4-4-4" }
- portals[5] = { "Floor 4 - Spare Floor" , "5-5-5" }
- portals[6] = { "Floor 5 - Chemical Processing", "2-2-2" }
- portals[7] = { "Floor 6 - Ore Processing", "6-6-6" }
- portals[8] = { "Floor 7 - Smeltery" , "7-7-7" }
- portals[9] = { "Floor 8 - Tinkermania", "8-8-8"}
- --table.sort(portals)
- --local myTimer
- mon2 = peripheral.wrap('top')
- --mon2.clear()
- dial = peripheral.wrap("right")
- monitor = peripheral.wrap("left")
- controller = peripheral.wrap("ep_controller_1")
- portalActive = false
- locationCount = 0
- function update()
- portalActive = controller.isPortalActive()
- locationCount = #portals
- end
- function drawScreen()
- i = 1
- if not portalActive == true then
- mon2.clear()
- end
- -- monitor.setBackgroundColor(colors.green)
- -- monitor.clear()
- -- monW, monH = monitor.getSize()
- -- monitor.setCursorPos(monW / 2 - string.len("Terminate") / 2, monH / 2)
- -- monitor.write("Terminate")
- -- mon2.setBackgroundColor(colors.red)
- -- mon2.clear()
- monitor.setBackgroundColor(colors.black)
- monitor.clear()
- for index,values in pairs(portals) do
- name = values[1]
- monitor.setCursorPos(1, i)
- if (i % 2 == 0) then
- monitor.setBackgroundColor(colors.gray)
- else
- monitor.setBackgroundColor(colors.lightGray)
- end
- monW, monH = monitor.getSize()
- monitor.write(name)
- k = string.len(name)
- while (k < monW) do
- monitor.write(" ")
- k = k + 1
- end
- i = i + 1
- end
- end
- function handleInput()
- event, side, posX, posY = os.pullEvent("monitor_touch")
- if portalActive then
- dial.terminate()
- else
- if posY <= #portals then
- mon2.setCursorPos(1,1)
- -- if unexpected_condition then error() end
- local ok,error = pcall( dial.dial, portals[posY][2])
- if not ok then
- mon2.write("Whoops - Try Again")
- else
- mon2.write(portals[posY][1])
- end
- -- myTimer = os.startTimer(8)
- --local event,timerID= os.pullEvent("timer")
- --os.sleep(10)
- --mon2.clear()
- end
- end
- end
- while true do
- update()
- drawScreen()
- handleInput()
- os.sleep(1)
- -- event, timerID = os.pullEvent("timer")
- --if timerID == myTimer then
- --mon2.clear()
- --end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement