Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.wrap("right")
- modem.open(00004)
- redstone.setOutput("front",true)
- redstone.setOutput("top",false)
- if fs.exists("save_data.lua") then
- local h = fs.open("save_data.lua", "r")
- local data = h.readAll()
- h.close()
- compNum = data
- compMsg = "s"..compNum
- end
- term.clear()
- term.setCursorPos(1,1)
- print("Waiting on message")
- while true do
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- term.clear()
- term.setCursorPos(1,1)
- print("Message received: "..message)
- print("Channel: "..senderChannel)
- if senderChannel == 4 then
- if message == compMsg then
- redstone.setOutput("front",true)
- redstone.setOutput("top",true)
- sleep(0.1)
- redstone.setOutput("front",false)
- elseif message == "serror" then
- for x = 1,4 do
- redstone.setOutput("front",true)
- redstone.setOutput("top",true)
- sleep(0.1)
- redstone.setOutput("front",false)
- redstone.setOutput("top",false)
- sleep(0.1)
- end
- end
- end
- sleep(0.1)
- end
Advertisement
Add Comment
Please, Sign In to add comment