I have this lua and it worked just fine back in may, then yesterday I came back to test it out after several months not used, and now, nothing, did anything change in Ghub/Lua?
This is the script:
function OnEvent(event, arg) OutputLogMessage("event = %s, arg = %d\n", event, arg) if (event == "PROFILE_ACTIVATED") then EnablePrimaryMouseButtonEvents(true) elseif event == "PROFILE_DEACTIVATED" then ReleaseMouseButton(2) -- to prevent it from being stuck on end if (event == "MOUSE_BUTTON_PRESSED" and arg == 7) then recoil = not recoil end if (event == "MOUSE_BUTTON_PRESSED" and arg == 1 and recoil) then if recoil then repeat Sleep(18) MoveMouseRelative(0,2) until not IsMouseButtonPressed(1) end end end
I tried reinstalling Logitech Ghub several times including reboots, nothing changed.
EDIT I added this at the top of my script, and it seems to have done the trick.
In the current version of GHub the
PROFILE_ACTIVATED event has its second parameter
arg=nil (in the previous versions
0), so you must replace
OutputLogMessage("event = %s, arg = %d\n", event, arg)
OutputLogMessage("event = %s, arg = %s\n", event, tostring(arg))
OutputLogMessage("event = %s, arg = %d\n", event, arg or 0)
Without such modification, all your GHub scripts now fail to handle events
PROFILE_DEACTIVATED as the code generates an exception at the line