Posted 29 July 2014 - 05:35 PM
When i try to run this program, i get the error "colors:36: to few arguments" I would like some help,
local cableSide = "bottom" -- Or where ever your cable is.
local mon = peripheral.wrap("top") -- Or where ever your colour monitor is.
mon.setTextColor(colours.white)
mon.setBackgroundColor(colours.black)
mon.clear()
local xLen, yLen = mon.getSize()
local myEvent
-- Menu items.
-- Add as desired, but don't exceed 16 entries.
local switches = {
["Power Tower #1"] = {colour = colours.orange, screenRow = 1},
["Power Tower #2"] = {colour = colours.magenta, screenRow = 2},
["Power Tower #3"] = {colour = colours.lightBlue, screenRow = 3},
["Power Tower #4"] = {colour = colours.yellow, screenRow = 4},
["Power Tower #5"] = {colour = colours.lime, screenRow = 5},
["Power Tower #6"] = {colour = colours.pink, screenRow = 6},
["Power Tower #7"] = {colour = colours.gray, screenRow = 7},
["Power Tower #8"] = {colour = colours.lightGray, screenRow = 8},
["Power Tower #9"] = {colour = colours.cyan, screenRow = 9}}
-- Initial menu render:
for key,value in pairs(switches) do
mon.setBackgroundColor(colours.black)
mon.setCursorPos(2,value.screenRow)
mon.write(key)
mon.setCursorPos(xLen-5,value.screenRow)
if colours.test(rs.getBundledOutput(cableSide),value.colour) then
mon.setBackgroundColor(colours.green)
mon.write(" On ")
else
mon.setBackgroundColor(colours.red)
mon.write(" Off ")
end
end
-- Main program loop.
while true do
myEvent = {os.pullEvent("monitor_touch")}
for key,value in pairs(switches) do if myEvent[4] == value.screenRow then
mon.setCursorPos(xLen-5,value.screenRow)
if not colours.test(rs.getBundledOutput(cableSide),value.colour) then
mon.setBackgroundColor(colours.green)
mon.write(" On ")
rs.setBundledOutput(cableSide,colours.combine(rs.getBundledOutput(cableSide),value.colour))
else
mon.setBackgroundColor(colours.red)
mon.write(" Off ")
rs.setBundledOutput(cableSide,colours.subtract(rs.getBundledOutput(cableSide),value.colour))
end
break
end end
end