Kcoder
Kcoder

Reputation: 3480

Lua Scripting error with G-Key script SetMkeyState

I have a G602 mouse and I want to use the DPI sensitive buttons (G10, G11) to control the M-Key state of my G910 keyboard. I'm trying to write a Lua script for it, but I'm having problems trying to set the M-Key state based off the API documentation sample:

if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    SetMkeyState(1,"kb")
end

I get the following error:

[string "LuaVM"]:20: attempt to call global 'SetMkeyState' (a nil value)

I even tried the exact sample from the API documentation and I get the same error:

-- Set the current M Key state to M1 when G1 is pressed
function OnEvent(event, arg)
    if (event == "G_PRESSED" and arg == 1) then
        SetMkeyState(1);
    end
end

Upvotes: 0

Views: 1350

Answers (1)

Kcoder
Kcoder

Reputation: 3480

The command is case-sensitive and the sample in API Documentation has a typo. The letter K in SetMkeyState should be upper-case.

Using SetMKeyState works:

if event == "MOUSE_BUTTON_PRESSED" and arg == 11 then
    SetMKeyState(1,"kb")
end

Upvotes: 1

Related Questions