Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RAILCRAFT ELEVATOR MONITOR "A" VERSION 1.4A MARCH 13TH 2014
- -- DESIGNED AND WRITTEN BY "MYSTERYDUMP"
- -- WWW.MYSTERYDUMP.COM
- -- ****IMPORTANT**** THIS IS THE "A" VERSION OF THE OVERHEAD MONITOR DISPLAY PROGRAM AND MUST BE USED WITH THE "A" VERSIONS OF THE ELEVATOR "CLIENT PROGRAMS" AND THE "A" VERSION OF THE ELEVATOR SERVER! IF YOU NEED HELP BUILDING AND/OR INSTALLING THE ELEVATOR AND THE SERVER/MONITOR/CLIENT PROGRAMS AND THEN CONFIGURING THEM, GO TO MYSTERYDUMP.COM/ELEVATOR FOR HELP.
- -- SET WHICH FLOOR THIS MONITOR WILL BE INSTALLED ON HERE (Enter 1 through 7)
- local floorLevel = 7 -- <-----------******** CHANGE TO FLOOR LEVEL NUMBER YOU ARE INSTALLING THIS MONITOR ON ********
- -- SET BUNDLED CABLE TO "TOP" AND INITIALIZE IN/OUTPUTS (OFF)
- local cablePort = "top"
- rs.setBundledOutput(cablePort, 0 )
- -- MONITOR SETUP
- mon = peripheral.wrap("back")
- -- SET "LOCALS"
- local cartFloor = 0
- local level07Detector = redstone.testBundledInput(cablePort, colors.white)
- local level06Detector = redstone.testBundledInput(cablePort, colors.magenta)
- local level05Detector = redstone.testBundledInput(cablePort, colors.yellow)
- local level04Detector = redstone.testBundledInput(cablePort, colors.pink)
- local level03Detector = redstone.testBundledInput(cablePort, colors.lightGray)
- local level02Detector = redstone.testBundledInput(cablePort, colors.purple)
- local level01Detector = redstone.testBundledInput(cablePort, colors.brown)
- -- TIMERS
- timerA = os.startTimer(1.5)
- -- CLEAR & INITIALIZE TERMINAL & MONITOR SCREENS
- function Monitor()
- term.clear()
- term.setCursorPos(1,1)
- print "Elevator Monitor Program v1.4a"
- term.setCursorPos(1,3)
- print "System: Online"
- term.setCursorPos(1,5)
- print "Searching for Cart, Please wait... "
- sleep(2)
- -- CLEAR & INITIALIZE MONITOR SCREEN (BACK)
- mon.clear()
- mon.setTextScale(1)
- mon.setTextColor(colors.white)
- mon.setCursorPos(1,1)
- mon.write "Floor"
- mon.setCursorPos(7,1)
- mon.write (tostring(floorLevel))
- mon.setCursorPos(1,3)
- mon.write "Startup"
- end
- -- DETECT CART LOCATION (FUNCTION)
- detectCurrentFloor = function()
- readyBusy()
- level07Detector = redstone.testBundledInput(cablePort, colors.white)
- if level07Detector == true then
- cartFloor = 7
- else
- end
- level06Detector = redstone.testBundledInput(cablePort, colors.magenta)
- if level06Detector == true then
- cartFloor = 6
- else
- end
- level05Detector = redstone.testBundledInput(cablePort, colors.yellow)
- if level05Detector == true then
- cartFloor = 5
- else
- end
- level04Detector = redstone.testBundledInput(cablePort, colors.pink)
- if level04Detector == true then
- cartFloor = 4
- else
- end
- level03Detector = redstone.testBundledInput(cablePort, colors.lightGray)
- if level03Detector == true then
- cartFloor = 3
- else
- end
- level02Detector = redstone.testBundledInput(cablePort, colors.purple)
- if level02Detector == true then
- cartFloor = 2
- else
- end
- level01Detector = redstone.testBundledInput(cablePort, colors.brown)
- if level01Detector == true then
- cartFloor = 1
- else
- end
- if level01Detector == false and level02Detector == false and level03Detector == false and level04Detector == false and level05Detector == false and level06Detector == false and level07Detector == false then
- cartFloor = 0
- mon.setTextColor(colors.red)
- mon.setCursorPos(1,3)
- mon.write " Busy! "
- else
- end
- end
- -- UPDATE "READY OR BUSY" ON MONITOR (FUNCTION)
- function readyBusy()
- if cartFloor == 0 then
- timerA = os.startTimer(1.5)
- end
- event, completed = os.pullEvent()
- if event == "timer" then
- if completed == timerA then
- mon.setTextColor(colors.white)
- mon.setCursorPos(1,3)
- mon.write " Ready "
- else
- mon.setTextColor(colors.red)
- mon.setCursorPos(1,3)
- mon.write " Busy! "
- end
- end
- end
- -- UPDATE TERMINAL & MONITOR SCREENS (FUNCTION)
- updateMonitor = function()
- term.clear()
- term.setCursorPos(1,1)
- print "Elevator Monitor Program v1.4a"
- term.setCursorPos(1,3)
- print "System: Online"
- term.setCursorPos(1,5)
- print ("Cart on Floor: ", (cartFloor))
- if cartFloor == 1 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write " 234567"
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 2 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "1 34567"
- mon.setCursorPos(2,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 3 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "12 4567"
- mon.setCursorPos(3,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 4 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "123 567"
- mon.setCursorPos(4,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 5 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "1234 67"
- mon.setCursorPos(5,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 6 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "12345 7"
- mon.setCursorPos(6,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- if cartFloor == 7 then
- mon.setCursorPos(1,5)
- mon.setTextColor(colors.gray)
- mon.write "123456 "
- mon.setCursorPos(7,5)
- mon.setTextColor(colors.red)
- mon.write (tostring(cartFloor))
- end
- end
- -- BEGIN PROGRAM
- Monitor()
- while true do
- sleep(0)
- parallel.waitForAll (detectCurrentFloor, updateMonitor)
- end
Add Comment
Please, Sign In to add comment