- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-19-2010 09:46 PM
Works like a charm!! Now that I have a script that is working, time to start messing around and learn something. Thanks again for taking the time to explain.
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-20-2010 05:28 PM
I forgot to mention that you can have it cycle between more than two colors (i used red and blue in the script i posted here). I mean you can have it cycle between red, blue, purple, black, etc. Would you benefit from that?
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-21-2010 08:10 PM
Thanks for the assignment. Going to give it a shot. I'll let you know my progress........HaHa. Extended the sleep cycle (150) Big woop Going for r+b+Purple.
Davs - Next lesson can we tap into the USB sound output to get this thing rock'in?? <-- J/K
- Peace
Re: G110 Cycle Colors Mac OSX
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2010 01:09 AM - edited 02-08-2010 01:57 AM
i've been trying to make these scripts work but i cant seem to make/edit one that will fade from blue to red and all in between SMOOTHLY.
I would love for some assistance!
EDIT:
I've got it, thing is it wont stop. I have G6 bound to "Script" and in the Edit>script editor i have this script
[CODE]function OnEvent(event, arg)
local r = 0
local b = 255
rdir = 1
bdir = 1
repeat
r = RedCycle(r);
b = BlueCycle(b);
SetBacklightColor(r, 0, b);
until ( event=="PROFILE_DEACTIVATED" )
SetBacklightColor(129, 129); --white
end
function RedCycle(r)
if (r >= 255) then
rdir = 0
r = 254
Sleep(150);
return r
elseif (r <= 0) then
rdir = 1
r = 1
Sleep(100);
return r
elseif (r < 255) then
if (rdir == 1) then
r = r + 1
Sleep(15);
return r
elseif (rdir == 0) then
r = r - 1
Sleep(45);
return r
end
end
end
function BlueCycle(b)
if (b >= 255) then
bdir = 0
b = 254
Sleep(100);
return b
elseif (b <= 0) then
bdir = 1
b = 1
Sleep(100);
return b
elseif (b < 255) then
if (bdir == 1) then
b = b + 1
Sleep(55);
return b
elseif (bdir == 0) then
b = b - 1
Sleep(15);
return b
end
end
end
[code\]
id like to be able to toggle it on and off with g6 can anyone offer help?
This code seems to crash the profiler very often
Re: G110 Cycle Colors Mac OSX
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2010 03:51 AM - edited 02-10-2010 04:05 AM
Scripted G-keys must also have an associated trigger event, so enclose the cycler with:
if (event=="G_PRESSED" and arg==6) then
--Colour cycler goes in here!
end
Also, trigger events can't be used for loop arguments, so you can't kill a loop with G-key press/release or profile activation/de-activation events, but you can read the M-key state (NOT M-press/release events, but the currently active M state) and use that to kill the loop. At least, that's my experience.
Unfortunately, if the loop is running when the profile changes, the profiler attempts to abort the script, and borks instead. It's waiting for the script to end, but the script is stuck in a loop, and the M keys become unresponsive.
A way to get around this is to include a break sequence (like left-Alt + right-Alt) to abort the script. This should still abort the script even when the profiler is frozen. It works for me, anyway. ![]()
Try replacing the line:
until ( event=="PROFILE_DEACTIVATED" )
With (for example):
until GetMKeyState()=3 or (IsModifierPressed("lalt") and IsModifierPressed("ralt"))
Then just press M3 or both Alt keys (or whatever the Mac equivalent is) together to stop it cycling - only the dual Alt press will be functional if the profiler is frozen.
The code should end up like this:
function OnEvent(event, arg)
if (event=="G_PRESSED" and arg==6) then
local r = 0
local b = 255
rdir = 1
bdir = 1
repeat
r = RedCycle(r);
b = BlueCycle(b);
SetBacklightColor(r, 0, b);
until GetMKeyState()=3 or (IsModifierPressed("lalt") and IsModifierPressed("ralt"))
SetBacklightColor(129, 129); --white
end
end
function RedCycle(r)
if (r >= 255) then
rdir = 0
r = 254
Sleep(150);
return r
elseif (r <= 0) then
rdir = 1
r = 1
Sleep(100);
return r
elseif (r < 255) then
if (rdir == 1) then
r = r + 1
Sleep(15);
return r
elseif (rdir == 0) then
r = r - 1
Sleep(45);
return r
end
end
end
function BlueCycle(b)
if (b >= 255) then
bdir = 0
b = 254
Sleep(100);
return b
elseif (b <= 0) then
bdir = 1
b = 1
Sleep(100);
return b
elseif (b < 255) then
if (bdir == 1) then
b = b + 1
Sleep(55);
return b
elseif (bdir == 0) then
b = b - 1
Sleep(15);
return b
end
end
end ...but I haven't tested it, so I may have borked it. You get the idea though, I hope. ![]()
(o.0)
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2010 11:46 PM
yooooooooo, beatiful. This worked great, thanks so much. I really need to lear LUA.![]()
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-11-2010 04:15 AM
I'm glad it works - the credit goes to Davs, of course, as I only added a couple of lines for you.
I honestly don't know LUA. There are some truly brilliant scripting examples all over these forums (and elsewhere) that are great to learn from.
I just got to grips with the G-series implementation by diving in - it's surprisingly easy to get along with, and I quickly learned the limitations while trying to do stuff that can't be done. Bit by bit, I'm starting to learn what can be done.
I created a colour cycling script for the G19 when I started. It's not as elegant as Davs, or as involved as KGober's HSL-based fader, but it was a good way to learn. You should think about what you want, and just jump in and try it - I bet you'll find it a lot easier than you think. ![]()
(o.0)
Re: G110 Cycle Colors Mac OSX
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-03-2010 06:54 AM
Can anyone help me make 1 script for G110 color cycling for color red,blue,purple and red,blue,purple,black.Please.Thank you.
