Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Variabelen
- local sensor = peripheral.wrap("top")
- local monitor = peripheral.wrap("left")
- local modem = peripheral.wrap("right")
- local modemPort = 6 --unieke poort voor wissellocatie
- local mainFramePort = 5 --poort van mainframe
- local messagestore = 0
- -- Startcode
- modem.open(modemPort)
- -- Whilecode
- while true do
- nearusers = sensor.getPlayerNames()
- print("Nearby User: ", nearusers[1])
- if nearusers[1] ~= nil then
- modem.transmit(mainFramePort,modemPort,nearusers[1])
- local event, ModemSide, senderChannel, replyChannel,
- message, senderDistance = os.pullEvent("modem_message")
- print("switch information recieved on port ", senderChannel)
- print("switch number is ", message)
- messagestore=message
- end
- if messagestore == 1 then
- --Destination 1
- print("setting for destination 1")
- elseif messagestore == 2 then
- --Destination 2
- print("setting for destination 2")
- elseif messagestore == 3 then
- --Destination 3
- print("setting for destination 3")
- elseif messagestore == 4 then
- --Destination 4
- print("setting for destination 4")
- else
- --Geen mensen in de buurt
- print("no destinations nearby")
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement