Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("back")
- local monitor = peripheral.wrap("top")
- local CurFloor = 9
- monitor.clear()
- while true do
- id, Elev1R = rednet.receive("ElevatorFloor")
- id, Elev2R = rednet.receive("ElevatorFloor2")
- if Elev1R > 0 then
- Elev1 = Elev1R
- end
- if Elev2R > 0 then
- Elev2 = Elev2R
- end
- if rs.getInput("front") == true then
- Elev1D = math.abs(CurFloor - Elev1)
- Elev2D = math.abs(CurFloor - Elev2)
- if Elev1D < Elev2D then
- rednet.broadcast(CurFloor, "ElevatorTarget")
- else
- rednet.broadcast(CurFloor, "ElevatorTarget2")
- end
- os.sleep(2)
- end
- monitor.clear()
- monitor.setCursorPos(1,1)
- monitor.setTextScale(2.5)
- monitor.write(Elev1 .. "|" .. Elev2)
- os.sleep(0.10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement