Purpose, Makes lights randomly change rgb colour and cycles them to give a breathing effect.
Level:
Lua beginner = cut and paste code, create filters unit start and system update in lua editor , DU = know how to link lights to a programming board
Build
You need 1 Programming Board(PB) and some lights. Connect the lights to the PB and name each slot in the lua editor (Ctrl L) you have connected l1 , l2 etc. If you don't want 8 then edit the source code and remove.
code is below.
Other stuff you can do : add a detector to autostart , change parameters in unit start to get the feel you like.
-- copy and paste into unit start
unit.hide() -- hides programming board
-- remove these where you have not connected a light
l1.activate()
l2.activate()
l3.activate()
l4.activate()
l5.activate()
l6.activate()
l7.activate()
l8.activate()
bClock = system.getTime() -- start clock
origRgb = l1.getRGBColor() -- stores the colour of the original light if you want to reset lights on exit
breathRate = 1 --export: rate of breathing Multiplier
changeFrame = 1200 --export: frame colour and channel cycle
rgbIndex = utils.round(math.random(3)) -- choose channel to breathe
r = math.random(255) -- setup channels
g = math.random(255)
b = math.random(255)
frameCount = 0
-- Copy and Paste into System update
frameCount = frameCount + 1
if ( frameCount % changeFrame == 0 ) then --randomize rgb and channel
r = math.random(255)
g = math.random(255)
b = math.random(255)
rgbIndex = utils.round(math.random(3)) -- choose channel to breathe
end
nClock = system.getTime()
local timeSeconds = ( nClock - bClock)
local breath = utils.round(( math.exp( math.sin(timeSeconds * breathRate )) - 0.36787944 )* 108.0)
if rgbIndex == 1 then
r = breath
elseif rgbIndex == 2 then
g = breath
else
b = breath
end
-- set rgb colour of linked lights ,remove these where you have not connected a light
l1.setRGBColor(r,g,b)
l2.setRGBColor(r,g,b)
l3.setRGBColor(r,g,b)
l4.setRGBColor(r,g,b)
l5.setRGBColor(r,g,b)
l6.setRGBColor(r,g,b)
l7.setRGBColor(r,g,b)
l8.setRGBColor(r,g,b)
Hello dear NQ Team,
I would like to discuss a problem, that I am sure many others would agree with.
I ask you to share information about restarts, updates or problems with the server here in the forum.
For example, you could create a new category for this (mayxbe something like: server status or server status messages). But this would also be possible in the area of announcements.
I have already received a lot of feedback on the Discord Server and I also share the following opinion.
The DU Discord server is way too confusing and restless. It is very uncomfortable for me to even bother with it.
If you create an area for such messages on this forum and make sure that no one can reply, only the information can be read, everyone can relax and read the information they want to have here on the forum and see what's going on.
Personally, I think communication is a major weak point at Novaquark, and this is able to create a lot of frustration and anger.
Let's fix that together.
Thanks and Greetings,
Luukullus
(Sorry for my bad english, i hope you all are abe to unserstand me correctly)