Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----Functions-----
- local function AddOutput(sSide,...)
- local c = colors.combine(rs.getBundledOutput(sSide),...)
- rs.setBundledOutput(sSide,c)
- end
- local function RemoveOutput(sSide,...)
- local c = colors.subtract(rs.getBundledOutput(sSide),...)
- rs.setBundledOutput(sSide,c)
- end
- -------Table---------
- Table = {}
- Table[1]= {["on"] = false,["name"] = "Purple Lamp",["color"] = colors.purple}
- Table[2] = {["on"] = false,["name"] = "Green Lamp",["color"] = colors.red}
- Table[101] = {["on"] = false,["name"] = "Sprinkler 1",["color"] = colors.lime}
- Table[102] = {["on"] = false,["name"] = "Sprinkler 2",["color"] = colors.yellow}
- Table[103] = {["on"] = false,["name"] = "Sprinkler 3",["color"] = colors.brown}
- Table[104] = {["on"] = false,["name"] = "Sprinkler 4",["color"] = colors.white}
- all = colors.combine(colors.red,colors.yellow,colors.lime,colors.brown,colors.purple,colors.white)
- rs.setBundledOutput("top",all)
- ----------------------
- local function showtable()
- term.setCursorPos(1,1)
- term.clear()
- for i , v in pairs(Table) do
- c = Table[i]["on"]
- local s = "off"
- if c == true then
- s = "on"
- else
- s = "off"
- end
- l = Table[i]["name"]
- io.write(l)
- Cursorx,CursorY = term.getCursorPos()
- term.setCursorPos(14,CursorY)
- io.write(s.."\n")
- end
- term.setCursorBlink(true)
- io.write("> ")
- end
- ---------------------
- local function ChangeRS(number)
- if colors.test("top",Table[number]["color"]) then
- Table[number]["on"] = true
- RemoveOutput("top",Table[number]["color"])
- elseif colors.test("top",Table[number]["color"]) == false then
- Table[number]["on"] = false
- AddOutput("top",Table[number]["color"])
- end
- end
- --~-------------------------
- function test(thing)
- local t = string.lower(thing)
- if string.find(t,"pu") then
- return 1
- elseif string.find(t,"gr") then
- return 2
- elseif string.find(t,"1") then
- return 101
- elseif string.find(t,"2") then
- return 102
- elseif string.find(t,"3") then
- return 103
- elseif string.find(t,"4") then
- return 104
- else
- return false
- end
- end
- ---------------------------
- reading = 0
- while true do
- showtable()
- read = test(io.read())
- if read then
- ChangeRS(read)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement