Reputation: 1
The script is activated only when the right and then the left mouse button is clicked first. I need to be able to activate the script by any sequence of pressing these two buttons.
I tried putting (event == "MOUSE_BUTTON_PRESSED" and arg == 3) together/before/after (event == "MOUSE_BUTTON_PRESSED" and arg == 1), but the script didn't want to activate in any way.
function OnEvent(event, arg)
if (event == "MOUSE_BUTTON_PRESSED" and arg == 1) and IsMouseButtonPressed(3) then
repeat
MoveMouseRelative(1 , 1)
if not IsMouseButtonPressed(1) then break end
until not IsMouseButtonPressed(1)
end
if (event == "PROFILE_ACTIVATED") then
EnablePrimaryMouseButtonEvents(true)
end
end
Upvotes: 0
Views: 530
Reputation: 1908
Include both variants in the condition: (arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1))
function OnEvent(event, arg)
if event == "PROFILE_ACTIVATED" then
EnablePrimaryMouseButtonEvents(true)
elseif event == "MOUSE_BUTTON_PRESSED" and (arg == 1 and IsMouseButtonPressed(3) or arg == 2 and IsMouseButtonPressed(1)) then
repeat
MoveMouseRelative(1, 1)
Sleep(10)
until not IsMouseButtonPressed(1)
end
end
Upvotes: 0