Hello so im trying to make a script in which i press a mouse button and it starts repeating keys until i press the button again.
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
repeat
PressKey("3","4","5","6","7","8","9","0")
Sleep(100)
ReleaseKey("3","4","5","6","7","8","9","0")
until not IsMouseButtonPressed(4)
end
end
i cant seem to get it working with toggle..
You may have problems trying to keep pressed 8 keys simultaneously.
Windows allows maximum 6 keys to be down at the same time.
local btn4
local function is_btn4_pressed_again()
Sleep(10)
local btn4_current_state = IsMouseButtonPressed(4)
local answer = not btn4 and btn4_current_state
btn4 = btn4_current_state
return answer
end
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 4 then
btn4 = not btn4
if btn4 then
repeat
PressKey("3","4","5","6","7","8","9","0")
Sleep(100)
ReleaseKey("3","4","5","6","7","8","9","0")
until is_btn4_pressed_again()
end
end
end