Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if fs.exists("/Chock0Sfile") == false then
- print("C> setting up")
- fs.makeDir("Chock0S")
- local file = fs.open("Chock0Sfile/config","w")
- file.writeLine("modem placement")
- file.writeLine("id")
- file.writeLine("function")
- file.close()
- end
- file = fs.open("Chock0Sfile/config","r")
- local fileData = {}
- local line = file.readLine()
- repeat
- table.insert(fileData,line)
- line = file.readLine()
- until line == nil
- file.close()
- print(fileData[1])
- print(fileData[2])
- print(fileData[3])
- modemplacement = fileData[1]
- id = fileData[2]
- funct = fileData[3]
- rednet.open(modemplacement)
- while true do
- if funct == "dummy" then
- mes = read()
- prot = read()
- rednet.broadcast(mes,prot)
- end
- if funct == "util" then
- print("util")
- sender,message,protocol = rednet.receive()
- print(message..sender..protocol)
- if message == "ping" then
- rednet.broadcast("pingback",sender)
- print("ping!")
- end
- if protocol == id then
- if message == "open" then
- print("open")
- redstone.setBundledOutput("left",colors.white)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement