I'll check it out when I get back to my laptop. Might be a few hours. However, to tide you over, unless you have a keyboard or gamepad (I.e. G13), the "mkey = ......" lines are unnecessary as the 930 has no memory key. It's also my preference to use "family ~=......" for an if statement instead of an if/else statement. But, my personal preferences aside, the code looks fine....not sure why it's acting up.
EDIT: Found your problem. For your scripting, you have all of your IF Statements nested so that to get gkey 2 and 3 you have to be pressing 1 as well. Here's your exact code from the 2nd example but with the "end"s in the correct places.
Code:
function OnEvent(event, gkey, family)
mkey = GetMKeyState()
if family == "kb" or family == "lhc" then
else
if gkey == 1 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_PTT_TOGGLE")
end
end
if gkey == 2 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_INPUT_TOGGLE")
end
end
if gkey == 3 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_OUTPUT_TOGGLE")
end
end
end
end
Below is the differences in our code:
Your code did this:
Code:
function OnEvent(event, gkey, family)
-->mkey = GetMKeyState()
-->if family == “kb” or family == “lhc” then
-->else
-->-->if gkey == 1 then
-->-->-->if event == “G_PRESSED” then
-->-->-->-->OutputDebugMessage(“TS3_PTT_TOGGLE”)
-->-->-->-->if gkey == 2 then
-->-->-->-->-->if event == “G_PRESSED” then
-->-->-->-->-->-->OutputDebugMessage(“TS3_INPUT_TOGGLE”)
-->-->-->-->-->-->if gkey == 3 then
-->-->-->-->-->-->-->if event == “G_PRESSED” then
-->-->-->-->-->-->-->OutputDebugMessage(“TS3_OUTPUT_TOGGLE”)
-->-->-->-->-->-->-->end
-->-->-->-->-->-->end
-->-->-->-->-->end
-->-->-->-->end
-->-->-->end
-->-->end
-->end
end
My code does this:
Code:
function OnEvent(event, gkey, family)
-->mkey = GetMKeyState()
-->if family == "kb" or family == "lhc" then
-->else
-->-->if gkey == 1 then
-->-->-->if event == "G_PRESSED" then
-->-->-->-->OutputDebugMessage("TS3_PTT_TOGGLE")
-->-->-->end
-->-->end
-->-->if gkey == 2 then
-->-->-->if event == "G_PRESSED" then
-->-->-->-->OutputDebugMessage("TS3_INPUT_TOGGLE")
-->-->-->end
-->-->end
-->-->if gkey == 3 then
-->-->-->if event == "G_PRESSED" then
-->-->-->-->OutputDebugMessage("TS3_OUTPUT_TOGGLE")
-->-->-->end
-->-->end
-->end
end
Finally, based on my preferences, this is what I would use as my code if I wanted your gkey functions:
Code:
function OnEvent(event, gkey, family)
if family ~= "kb" or family ~= "lhc" then
if gkey == 1 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_PTT_TOGGLE")
end
end
if gkey == 2 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_INPUT_TOGGLE")
end
end
if gkey == 3 then
if event == "G_PRESSED" then
OutputDebugMessage("TS3_OUTPUT_TOGGLE")
end
end
end
end