Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---light switcher by elektrobom1---
- local l = require("CLamp")
- local arg = {...}
- local per = peripheral.getNames()
- local num = 1
- local max = 0
- local tpos = {term.getCursorPos()}
- for i = 1, #per do
- if peripheral.getType(per[i]) == "colorful_lamp" then
- max = max + 1
- end
- end
- for i = 1, #per do
- if peripheral.getType(per[i]) == "colorful_lamp" then
- term.setCursorPos(tpos[1], tpos[2]-1)
- print("setting lamp: " .. num .. "/" .. max .. " to: " .. "R:" .. arg[1] .. " G:" .. arg[2] .. " B:" .. arg[3])
- peripheral.call(per[i], "setLampColor", l.rgb(tonumber(arg[1]), tonumber(arg[2]), tonumber(arg[3])))
- num = num + 1
- end
- end
- print("finished")
Add Comment
Please, Sign In to add comment