Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modemSide = "top"
- controlComputerID = 6
- callComputerID1 = 28
- callComputerID2 = 99
- callComputerID3 = 99
- callComputerID4 = 99
- callComputerID5 = 99
- callComputerID6 = 99
- rednet.open(modemSide)
- function UserInput()
- term.clear()
- term.setCursorPos(1,1)
- outputFloor()
- print("Enter The Floor Number You Want To Go To")
- while true do
- local input = read()
- if input == "1" then
- calculateFloors(1)
- break
- elseif input == "2" then
- calculateFloors(2)
- break
- elseif input == "3" then
- calculateFloors(3)
- break
- elseif input == "4" then
- calculateFloors(4)
- break
- elseif input == "5" then
- calculateFloors(5)
- break
- elseif input == "6" then
- calculateFloors(6)
- break
- elseif input == "DebugUp" then
- rednet.send(controlComputerID, input)
- UserInput()
- break
- elseif input == "DebugDown" then
- rednet.send(controlComputerID, input)
- UserInput()
- break
- end
- end
- end
- function outputFloor()
- local floorSignal = redstone.getAnalogInput("back")
- if floorSignal ~= 0 then
- rednet.send(callComputerID1, floorSignal)
- rednet.send(callComputerID2, floorSignal)
- rednet.send(callComputerID3, floorSignal)
- rednet.send(callComputerID4, floorSignal)
- rednet.send(callComputerID5, floorSignal)
- rednet.send(callComputerID6, floorSignal)
- end
- end
- function calculateFloors(desiredFloor)
- local floorDifference = getCurrentFloor() - desiredFloor
- if floorDifference == 0 then
- UserInput()
- end
- rednet.send(controlComputerID, floorDifference)
- UserInput()
- end
- function getCurrentFloor()
- local signal = redstone.getAnalogInput("back")
- if signal == 0 then
- print("Not Currently On A Floor. Type DebugUp Or DebugDown To Move Up Or Down One Block")
- os.sleep(5)
- UserInput()
- else
- return signal
- end
- end
- UserInput()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement