Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function addcol(col, side)
- rs.setBundledOutput(side, colors.combine(rs.getBundledOutput(side),col))
- end
- local function remcol(col, side)
- rs.setBundledOutput(side, colors.subtract(rs.getBundledOutput(side),col))
- end
- local count = 0
- redstone.setBundledOutput("back", 0)
- rednet.open("top")
- term.clear()
- term.setCursorPos(1,1)
- term.write("Server id is: "..os.getComputerID())
- term.setCursorPos(1,2)
- term.write("Waiting for a host computer to send commands...")
- while true do
- event, id, text, protocol = os.pullEvent()
- if event == "rednet_message" then
- if protocol == "BaseControl" then
- count = count + 1
- term.setCursorPos(1,count+3)
- term.clearLine()
- term.write(text)
- color = ""
- state = ""
- num = 1
- for i in string.gmatch(text, "([^/]+)") do
- if num == 1 then
- color = i
- elseif num == 2 then
- state = i
- end
- num = num + 1
- end
- if color == "blue" then
- if state == "Off" then
- remcol(colors.blue,"back")
- else
- addcol(colors.blue,"back")
- end
- elseif color == "pink" then
- if state == "Off" then
- remcol(colors.pink,"back")
- else
- addcol(colors.pink,"back")
- end
- elseif color == "lime" then
- if state == "Off" then
- remcol(colors.lime,"back")
- else
- addcol(colors.lime,"back")
- end
- elseif color == "white" then
- if state == "Off" then
- remcol(colors.white,"back")
- else
- addcol(colors.white,"back")
- end
- elseif color == "orange" then
- if state == "Off" then
- remcol(colors.orange,"back")
- else
- addcol(colors.orange,"back")
- end
- elseif color == "magenta" then
- if state == "Off" then
- remcol(colors.magenta,"back")
- else
- addcol(colors.magenta,"back")
- end
- elseif color == "lightblue" then
- if state == "Off" then
- remcol(colors.lightBlue,"back")
- else
- addcol(colors.lightBlue,"back")
- end
- elseif color == "yellow" then
- if state == "Off" then
- remcol(colors.yellow,"back")
- else
- addcol(colors.yellow,"back")
- end
- elseif color == "cyan" then
- if state == "Off" then
- remcol(colors.cyan,"back")
- else
- addcol(colors.cyan,"back")
- end
- elseif color == "purple" then
- if state == "Off" then
- remcol(colors.purple,"back")
- else
- addcol(colors.purple,"back")
- end
- elseif color == "brown" then
- if state == "Off" then
- remcol(colors.brown,"back")
- else
- addcol(colors.brown,"back")
- end
- elseif color == "green" then
- if state == "Off" then
- remcol(colors.green,"back")
- else
- addcol(colors.green,"back")
- end
- elseif color == "red" then
- if state == "Off" then
- remcol(colors.red,"back")
- else
- addcol(colors.red,"back")
- end
- elseif color == "black" then
- if state == "Off" then
- remcol(colors.black,"back")
- else
- addcol(colors.black,"back")
- end
- elseif color == "lightgray" then
- if state == "Off" then
- remcol(colors.lightGray,"back")
- else
- addcol(colors.lightGray,"back")
- end
- elseif color == "gray" or color == "Gray" then
- if state == "Off" then
- remcol(colors.gray,"back")
- else
- addcol(colors.gray,"back")
- end
- elseif color == "alloff" or color == "AllOff" then
- redstone.setBundledOutput("back", 0)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement