Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rgb = 31744
- local from = "F00"
- local to = "FF0"
- function incR()
- rgb = rgb + 1024
- end
- function decR()
- rgb = rgb - 1024
- end
- function incG()
- rgb = rgb + 32
- end
- function decG()
- rgb = rgb - 32
- end
- function incB()
- rgb = rgb + 1
- end
- function decB()
- rgb = rgb - 1
- end
- function nextColor(c, f, t)
- if f == "F00" and t == "FF0" then
- return c + 32
- elseif f == "FF0" and t == "0F0" then
- return c - 1024
- elseif f == "0F0" and t == "0FF" then
- return c + 1
- elseif f == "0FF" and t == "00F" then
- return c - 32
- elseif f == "00F" and t == "F0F" then
- return c + 1024
- elseif f == "F0F" and t == "F00" then
- return c - 1
- else
- return c
- end
- end
- function getTo(c, t)
- if t == "FF0" and rgb == 32736 then
- return "0F0"
- elseif t == "0F0" and rgb == 992 then
- return "0FF"
- elseif t == "0FF" and rgb == 1023 then
- return "00F"
- elseif t == "00F" and rgb == 31 then
- return "F0F"
- elseif t == "F0F" and rgb == 31775 then
- return "F00"
- elseif t == "F00" and rgb == 31744 then
- return "FF0"
- end
- end
- function getFrom(c, t)
- if t == "FF0" and rgb == 32736 then
- return "FF0"
- elseif t == "0F0" and rgb == 992 then
- return "0F0"
- elseif t == "0FF" and rgb == 1023 then
- return "0FF"
- elseif t == "00F" and rgb == 31 then
- return "00F"
- elseif t == "F0F" and rgb == 31775 then
- return "F0F"
- elseif t == "F00" and rgb == 31744 then
- return "F00"
- end
- end
- local p1 = peripheral.wrap("colorful_lamp_1")
- local p2 = peripheral.wrap("colorful_lamp_2")
- local p3 = peripheral.wrap("colorful_lamp_3")
- local p4 = peripheral.wrap("colorful_lamp_4")
- local p5 = peripheral.wrap("colorful_lamp_5")
- local p6 = peripheral.wrap("colorful_lamp_6")
- local p7 = peripheral.wrap("colorful_lamp_7")
- local p8 = peripheral.wrap("colorful_lamp_8")
- local p9 = peripheral.wrap("colorful_lamp_9")
- local p10 = peripheral.wrap("colorful_lamp_10")
- local p11 = peripheral.wrap("colorful_lamp_11")
- local p12 = peripheral.wrap("colorful_lamp_12")
- local p13 = peripheral.wrap("colorful_lamp_13")
- local p14 = peripheral.wrap("colorful_lamp_14")
- local p15 = peripheral.wrap("colorful_lamp_15")
- local p16 = peripheral.wrap("colorful_lamp_16")
- local p17 = peripheral.wrap("colorful_lamp_17")
- local p18 = peripheral.wrap("colorful_lamp_18")
- local p19 = peripheral.wrap("colorful_lamp_19")
- local p20 = peripheral.wrap("colorful_lamp_20")
- local p21 = peripheral.wrap("colorful_lamp_21")
- local p22 = peripheral.wrap("colorful_lamp_22")
- local p23 = peripheral.wrap("colorful_lamp_23")
- local p24 = peripheral.wrap("colorful_lamp_24")
- local p25 = peripheral.wrap("colorful_lamp_25")
- function main()
- while true do
- if to == "FF0" and rgb == 32736 then
- to = "0F0"
- from = "FF0"
- elseif to == "0F0" and rgb == 992 then
- to = "0FF"
- from = "0F0"
- elseif to == "0FF" and rgb == 1023 then
- to = "00F"
- from = "0FF"
- elseif to == "00F" and rgb == 31 then
- to = "F0F"
- from = "00F"
- elseif to == "F0F" and rgb == 31775 then
- to = "F00"
- from = "F0F"
- elseif to == "F00" and rgb == 31744 then
- to = "FF0"
- from = "F00"
- end
- cl = rgb
- f = from
- t = to
- p1.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p2.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p3.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p4.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p5.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p6.setLampColor(cl)
- p16.setLampColor(cl)
- p21.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p7.setLampColor(cl)
- p17.setLampColor(cl)
- p22.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p8.setLampColor(cl)
- p18.setLampColor(cl)
- p23.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p9.setLampColor(cl)
- p19.setLampColor(cl)
- p24.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p10.setLampColor(cl)
- p20.setLampColor(cl)
- p25.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p11.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p12.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p13.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p14.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- p15.setLampColor(cl)
- cl = nextColor(cl, f, t)
- f = getFrom(c, t)
- t = getTo(c, t)
- rgb = nextColor(rgb, from, to)
- os.sleep(0.05)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement