what I want to do is if I press the button on my mouse it uses a key like "E" and if I press the button again it uses the key "W", one more time press button "e", and again "w".
Is that possible?
I find this but it's not realy what i want:
https://stackoverflow.com/a/62067519/17803151
local prev_tm_btn5 = -math.huge
function OnEvent(event, arg, family)
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
local tm = GetRunningTime()
local key = tm - prev_tm_btn5 > 2000 and "e" or "w"
prev_tm_btn5 = tm
PressKey(key)
Sleep(15)
ReleaseKey(key)
end
end
thank you !
Try:
local key
function OnEvent(event, arg, family)
if event == "MOUSE_BUTTON_PRESSED" and arg == 5 then
key = key == "w" and "e" or "w"
PressKey(key)
Sleep(15)
ReleaseKey(key)
end
end