Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args = {...}
- if #args > 0 then
- name = table.concat(args, " ")
- else
- error("Provide a name")
- end
- shell.run("clear")
- local rside = "front"
- rednet.open("top")
- uID = name..":"..os.getComputerID()
- while true do
- print(uID," - Waiting for input...")
- sId, msg, prot = rednet.receive("engines")
- local replymsg
- local trim = msg:find(" ")
- if trim ~= nil then
- isvalid = true
- cmd = msg:sub(trim):gsub("%s+","")
- if cmd == "on" then
- rs.setOutput(rside, true)
- elseif cmd == "off" then
- rs.setOutput(rside, false)
- elseif cmd == "status" then
- -- do nothing
- elseif cmd == "ids" then
- replymsg = uID
- else
- isvalid = false
- end
- if isvalid and replymsg == nil then
- replymsg = uID.." - Engines Running: "..tostring(rs.getOutput(rside)).."|green"
- elseif replymsg ~= nil then
- -- do nothing
- else
- replymsg = uID.." - Invalid Command|red"
- end
- else
- replymsg = uID.." - Invalid Command|red"
- end
- rednet.send(sId, replymsg, prot)
- print(replymsg:sub(1,replymsg:find("|")-1))
- end
- rednet.close("top")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement