Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- // https://pastebin.com/wBYvYFFv
- os.pullEvent = os.pullEventRaw
- local modemside = "back"
- local elevatorfloorinputside = "right"
- local elevatorclutchoutputside = "top"
- local elevatordownoutputside = "left"
- local inputbase
- local floornumber = 0
- local gotofloor = 0
- local targetpcid
- local Ismovingup = nil
- print("Script Made By: TEC_NO")
- term.clear()
- print("-----------------------------------")
- write('Host PC ID: ')
- targetpcid = read()
- print("Script Made By: TEC_NO")
- print("-----------------------------------")
- inputbase = read()
- term.clear()
- print("-----------------------------------")
- print("Host PC Id: "..targetpcid)
- print("This PC Id: "..os.getComputerID())
- print("Script Made By: TEC_NO")
- print("-----------------------------------")
- inputbase = read()
- rednet.open(modemside)
- while true do
- sleep(0.048)
- local currentstatus = "?"
- if Ismovingup == nil then
- senderid, floortext = rednet.receive()
- currentstatus = "got message from: "..senderid.." with message: "..floortext
- if tonumber(senderid) == tonumber(targetpcid) then
- currentstatus = "correct senderid"
- if tonumber(floortext) ~= tonumber(floornumber) then
- currentstatus = "floor is not same number"
- gotofloor = tonumber(floortext)
- currentstatus = "floor is set to: "..floortext..":"..gotofloor
- end
- end
- end
- if rs.getInput(elevatorfloorinputside) == true then
- if Ismovingup ~= nil then
- if Ismovingup == true then
- floornumber = floornumber + 1
- elseif Ismovingup == false then
- floornumber = floornumber - 1
- end
- end
- end
- if Ismovingup ~= nil then
- rs.setOutput(elevatordownoutputside, Ismovingup)
- end
- term.clear()
- print("-----------------------------------")
- print("ElevatorOS.exe")
- print("Script Made By: TEC_NO")
- print("-----------------------------------")
- local dummysatusIsmovingup = "nil"
- if Ismovingup ~= nil then
- if Ismovingup == true then
- dummysatusIsmovingup = "true"
- elseif Ismovingup == false then
- dummysatusIsmovingup = "false"
- else
- dummysatusIsmovingup = "?"
- end
- end
- print("gotofloor: "..gotofloor.." | floornumber:"..floornumber.." | currentstatus:"..currentstatus.." | Ismovingup :"..dummysatusIsmovingup.." | targetpcid:"..targetpcid.." | id:"..os.getComputerID().." | event:"..math.random())
- if tonumber(gotofloor) ~= tonumber(floornumber) then
- if tonumber(floornumber) < tonumber(gotofloor) then
- Ismovingup = true
- rs.setOutput(elevatorclutchoutputside, true)
- elseif tonumber(floornumber) > tonumber(gotofloor) then
- Ismovingup = false
- rs.setOutput(elevatorclutchoutputside, true)
- end
- else
- rs.setOutput(elevatorclutchoutputside, false)
- Ismovingup = nil
- end
- end
Add Comment
Please, Sign In to add comment