Cause it was asked in this topic & on the video, I'd thought to share the code how to change the color on any KeyPress.
It's coded so that it works on G1 and it now only checks for the "ctrl" key.
You can of course edit it to your needs
code was based (color function) on the original code by the writer of this topic.
Code:
function OnEvent(event, arg)
if (event == "PROFILE_ACTIVATED") then
r1, g1, b1 = 0, 0, 0
color( 255, 0, 0, 25)
end
if (event == "M_PRESSED" and arg == 2) then
color( 255, 0, 0, 25)
end
if (event == "PROFILE_DEACTIVATED") then
color( 255, 0, 0, 15)
end
if (event == "G_PRESSED" and arg == 1) then
m = GetMKeyState()
while (GetMKeyState() == m) do
if(IsModifierPressed("ctrl")) then
color(255,0,80,1)
color(0,0,0,0)
end
end
end
end
--color(_r2, g2, b2, speed)
function color(r2, g2, b2, speed)
for loop = 5, 255, 50 do
SetBacklightColor((r2*loop+r1*(255-loop) )/255, (g2*loop+g1*(255-loop))/255, (b2*loop+b1*(255-loop))/255);
Sleep(speed)
end
r1 = r2
g1 = g2
b1 = b2
end
EDIT:
I noticed only a few keys can be used in the IsModifierPressed() function.
(r/l)alt ; (r/l)shift ; (r/l)ctrl
I'm investigating.
Edited by xewl - 7/30/11 at 4:12pm