G19+G510 Backlight Colour-Cycling Script
G19+G510 Backlight Colour-Cycling Script
-- Thanks to everyone.
------------------------|| CONTROLS: ||----------------------------------- R-Ctrl +
--M1
- Cycle R<>G
--M2
- Cycle G<>B
--M3
- Cycle B<>R
----- R-Shift +
--M1
- Cycle RGB
--M2
- Cycle RBG
--M3
- Colour Picker
----- While Cycling:
--- R-Shift +
--L-Shift - Faster
--L-Ctrl - Slower
----- L-Shift +
--R-Ctrl - Toggle LHC mode
--(G19/G13 sync)
----- While Picking:
--- R-Shift/R-Ctrl (brighter/darker) + --L-Shift - Red
--L-Ctrl - Green
--L-Alt - Blue
----- Press any other MKey to stop
--- cycling or picking, and keep
--- selected colour.
----------------------------------------------- **Cycle rate:
-- **(default = 150; red-to-red in ~23secs)
-- **(always set lower than mrate)
rate = 150
-- **Minimum delay:
-- **(default = 600; red-to-red in ~1.5mins)
-- **(higher is slower)
mrate = 600
-- **Static (RGB) Colour:
-- **(default = 140, 255, 150; white on my G19)
R, G, B = 140, 255, 150
function OnEvent(event,arg)
--
--
Cycle RGB:
if arg==1 then Cycle(0, 5, 0, 1, arg)
--
Cycle RBG:
elseif arg==2 then Cycle(255, -5, 2, -1, arg)
else
All done? Re-set new static colour after profiler applies default
Sleep(350)
SetBacklightColor(math.floor(R),math.floor(G),math.floor(B))
end
end
--
Reciprocating fade; Red <> Green or Green <> Blue or Blue <> Red:
if (event=="M_PRESSED") and IsModifierPressed("rctrl") then Fade(arg); end
end
function Fade(ks)
fs=0; fj=5; fd=0; run=1
while run~=null do
--
--
Change direction...
if fd==0 then fd=1; fs=255; fj=-5
else fd=0; fs=0; fj=5
--
end
function Cycle(cs, cj, rs, rj, ks)
run=1
while run~=null do
--
--
--
end
end
end
function Dlay(ks)
-Throttle controls during sleep.
for z = 1, rate, 1 do
--
Faster...
if IsModifierPressed("lshift") and IsModifierPressed("rshift") then rate
=(rate-(mrate/6000))
if rate<2 then rate=2
if limit~=0 then limit=0; OutputLCDMessage("\n"..(string.rep(" "
,37)).."Maximum", 3000); end
end
-Increments for display...
dup=math.floor((60/mrate)*rate)
if nup~=dup then Disp(); end
--
Slower...
elseif IsModifierPressed("lctrl") and IsModifierPressed("rshift") then r
ate=(rate+(mrate/6000))
if rate>mrate then rate=mrate; end
-Increments for display...
dup=math.floor((60/mrate)*rate)
if nup~=dup or limit~=1 then Disp(); limit=1; end
end
--
--