Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- side = "back"
- mon = peripheral.wrap("monitor_12")
- rs.setBundledOutput(side, 0)
- -- Variables - Don't touch please
- colWhite = 0
- colWhiteData = " "
- colOrange = 0
- colOrangeData = " "
- colMagenta = 0
- colMagentaData = " "
- colLightBlue = 0
- colLightBlueData = " "
- colYellow = 0
- colYellowData = " "
- colLime = 0
- colLimeData = " "
- colPink = 0
- colPinkData = " "
- colGray = 0
- colGrayData = " "
- colLightGray = 0
- colLightGrayData = " "
- colCyan = 0
- colCyanData = " "
- colPurple = 0
- colPurpleData = " "
- -- Generates a new data file (All bands are off by default)
- function generateColList()
- col = fs.open("colList", "w")
- col.writeLine("Rednet Color Band List")
- col.close()
- col = fs.open("colList", "a")
- col.writeLine("White: Off")
- col.writeLine("Orange: Off")
- col.writeLine("Magenta: Off")
- col.writeLine("Light Blue: Off")
- col.writeLine("Yellow: Off")
- col.writeLine("Lime: Off")
- col.writeLine("Pink: Off")
- col.writeLine("Gray: Off")
- col.writeLine("Light Gray: Off")
- col.writeLine("Cyan: Off")
- col.writeLine("Purple: Off")
- col.close()
- end
- -- Updates the data file
- function updateColList()
- col = fs.open("colList", "w")
- col.writeLine("Rednet Color Band List")
- col.close()
- col = fs.open("colList", "a")
- col.writeLine(colWhiteData)
- col.writeLine(colOrangeData)
- col.writeLine(colMagentaData)
- col.writeLine(colLightBlueData)
- col.writeLine(colYellowData)
- col.writeLine(colLimeData)
- col.writeLine(colPinkData)
- col.writeLine(colGrayData)
- col.writeLine(colLightGrayData)
- col.writeLine(colCyanData)
- col.writeLine(colPurpleData)
- col.close()
- end
- -- Prints the data file to a monitor (also sets the variables)
- function printData()
- term.redirect(mon)
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.white)
- col = fs.open("colList", "r")
- print(col.readLine())
- term.setCursorPos(1,3)
- colWhiteData = col.readLine()
- term.setTextColor(colors.white)
- write("White: ")
- if colWhiteData == "White: Off" then
- term.setTextColor(colors.red)
- colWhite = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colWhite = colors.white
- write("On")
- end
- term.setCursorPos(1,4)
- colOrangeData = col.readLine()
- term.setTextColor(colors.orange)
- write("Orange: ")
- if colOrangeData == "Orange: Off" then
- term.setTextColor(colors.red)
- colOrange = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colOrange = colors.orange
- write("On")
- end
- term.setCursorPos(1,5)
- colMagentaData = col.readLine()
- term.setTextColor(colors.magenta)
- write("Magenta: ")
- if colMagentaData == "Magenta: Off" then
- term.setTextColor(colors.red)
- colMagenta = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colMagenta = colors.magenta
- write("On")
- end
- term.setCursorPos(1,6)
- colLightBlueData = col.readLine()
- term.setTextColor(colors.lightBlue)
- write("Light Blue: ")
- if colLightBlueData == "Light Blue: Off" then
- term.setTextColor(colors.red)
- colLightBlue = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colLightBlue = colors.lightBlue
- write("On")
- end
- term.setCursorPos(1,7)
- colYellowData = col.readLine()
- term.setTextColor(colors.yellow)
- write("Yellow: ")
- if colYellowData == "Yellow: Off" then
- term.setTextColor(colors.red)
- colYellow = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colYellow = colors.Yellow
- write("On")
- end
- term.setCursorPos(1,8)
- colLimeData = col.readLine()
- term.setTextColor(colors.lime)
- write("Lime: ")
- if colLimeData == "Lime: Off" then
- term.setTextColor(colors.red)
- colLime = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colLime = colors.lime
- write("On")
- end
- term.setCursorPos(1,9)
- colPinkData = col.readLine()
- term.setTextColor(colors.pink)
- write("Pink: ")
- if colPinkData == "Pink: Off" then
- term.setTextColor(colors.red)
- colPink = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colPink = colors.pink
- write("On")
- end
- term.setCursorPos(1,10)
- colGrayData = col.readLine()
- term.setBackgroundColor(colors.lightGray)
- term.setTextColor(colors.gray)
- write("Gray:")
- term.setBackgroundColor(colors.black)
- write(" ")
- if colGrayData == "Gray: Off" then
- term.setTextColor(colors.red)
- colGray = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colGray = colors.gray
- write("On")
- end
- term.setCursorPos(1,11)
- colLightGrayData = col.readLine()
- term.setTextColor(colors.lightGray)
- write("Light Gray: ")
- if colLightGrayData == "Light Gray: Off" then
- term.setTextColor(colors.red)
- colLightGray = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colLightGray = colors.lightGray
- write("On")
- end
- term.setCursorPos(1,12)
- colCyanData = col.readLine()
- term.setTextColor(colors.cyan)
- write("Cyan: ")
- if colCyanData == "Cyan: Off" then
- term.setTextColor(colors.red)
- colCyan = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colCyan = colors.cyan
- write("On")
- end
- term.setCursorPos(1,13)
- colPurpleData = col.readLine()
- term.setTextColor(colors.purple)
- write("Purple: ")
- if colPurpleData == "Purple: Off" then
- term.setTextColor(colors.red)
- colPurple = 0
- write("Off")
- else
- term.setTextColor(colors.green)
- colPurple = colors.purple
- write("On")
- end
- col.close()
- term.restore()
- end
- -- Generates a data file if one isn't present
- if not fs.exists("colList") then
- generateColList()
- print("Color List Generated")
- sleep(2)
- end
- -- Main Program
- while true do
- printData()
- term.clear()
- term.setCursorPos(1,1)
- term.setTextColor(colors.yellow)
- if colors.combine(colWhite,colOrange,colMagenta,colLightBlue,colYellow,colLime,colPink) == 0 then
- rs.setBundledOutput(side, 0)
- else
- rs.setBundledOutput(side, colors.combine(colWhite,colOrange,colMagenta,colLightBlue,colYellow,colLime,colPink))
- end
- print("Please enter the band color you wish to toggle")
- print("See monitor for rednet color band list")
- print("type \"off\" to turn all bands off or \"on\" to turn them all on")
- input = read()
- if input == "white" or input == "White" then
- if colWhiteData == "White: Off" then
- colWhiteData = "White: On"
- print("White Band Toggled On")
- else
- colWhiteData = "White: Off"
- print("White Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "orange" or input == "Orange" then
- if colOrangeData == "Orange: Off" then
- colOrangeData = "Orange: On"
- print("Orange Band Toggled On")
- else
- colOrangeData = "Orange: Off"
- print("Orange Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "magenta" or input == "Magenta" then
- if colMagentaData == "Magenta: Off" then
- colMagentaData = "Magenta: On"
- print("Magenta Band Toggled On")
- else
- colMagentaData = "Magenta: Off"
- print("Magenta Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "lightblue" or input == "LightBlue" or input == "light blue" or input == "Light Blue" then
- if colLightBlueData == "Light Blue: Off" then
- colLightBlueData = "Light Blue: On"
- print("Light Blue Band Toggled On")
- else
- colLightBlueData = "Light Blue: Off"
- print("Light Blue Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "yellow" or input == "Yellow" then
- if colYellowData == "Yellow: Off" then
- colYellowData = "Yellow: On"
- print("Yellow Band Toggled On")
- else
- colYellowData = "Yellow: Off"
- print("Yellow Blue Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "lime" or input == "Lime" then
- if colLimeData == "Lime: Off" then
- colLimeData = "Lime: On"
- print("Lime Band Toggled On")
- else
- colLimeData = "Lime: Off"
- print("Lime Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "pink" or input == "Pink" then
- if colPinkData == "Pink: Off" then
- colPinkData = "Pink: On"
- print("Pink Band Toggled On")
- else
- colPinkData = "Pink: Off"
- print("Pink Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "gray" or input == "Gray" then
- if colGrayData == "Gray: Off" then
- colGrayData = "Gray: On"
- print("Gray Band Toggled On")
- else
- colGrayData = "Gray: Off"
- print("Gray Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "lightgray" or input == "LightGray" or input == "light gray" or input == "Light Gray" then
- if colLightGrayData == "Light Gray: Off" then
- colLightGrayData = "Light Gray: On"
- print("Light Gray Band Toggled On")
- else
- colLightGrayData = "Light Gray: Off"
- print("Light Gray Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "cyan" or input == "Cyan" then
- if colCyanData == "Cyan: Off" then
- colCyanData = "Cyan: On"
- print("Cyan Band Toggled On")
- else
- colCyanData = "Cyan: Off"
- print("Cyan Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "purple" or input == "Purple" then
- if colPurpleData == "Purple: Off" then
- colPurpleData = "Purple: On"
- print("Purple Band Toggled On")
- else
- colPurpleData = "Purple: Off"
- print("Purple Band Toggled Off")
- end
- sleep(2)
- updateColList()
- printData()
- elseif input == "on" or input == "On" then
- colWhiteData = "White: On"
- colOrangeData = "Orange: On"
- colMagentaData = "Magenta: On"
- colLightBlueData = "Light Blue: On"
- colYellowData = "Yellow: On"
- colLimeData = "Lime: On"
- colPinkData = "Pink: On"
- colGrayData = "Gray: On"
- colLightGrayData = "Light Gray: On"
- colCyanData = "Cyan: On"
- colPurpleData = "Purple: On"
- print("All bands toggled on")
- sleep(2)
- updateColList()
- printData()
- elseif input == "off" or input == "Off" then
- colWhiteData = "White: Off"
- colOrangeData = "Orange: Off"
- colMagentaData = "Magenta: Off"
- colLightBlueData = "Light Blue: Off"
- colYellowData = "Yellow: Off"
- colLimeData = "Lime: Off"
- colPinkData = "Pink: Off"
- colGrayData = "Gray: Off"
- colLightGrayData = "Light Gray: Off"
- colCyanData = "Cyan: Off"
- colPurpleData = "Purple: Off"
- print("All bands toggled off")
- sleep(2)
- updateColList()
- printData()
- else
- term.setTextColor(colors.red)
- print("Invalid Selection")
- sleep(2)
- end
- end
Add Comment
Please, Sign In to add comment