This is my first attempt at LUA so bear with me!
I'm trying to combine a couple of functions that I want to loop at the same time, but I can only get them to run sequentially. Ideally, the function bound to mouse button 6 would start on press and stop on release (currently it doesn't stop at all!!). Separately the function on mouse button 3 would run when it is pressed and stop on release (this one does stop).
At the moment the button 3 loop works as it should, but the button 6 loop doesn't end.
Ideally, I would like both to work and stop on their respective button press and release, AND for them to BOTH run at the same time when both 3 & 6 are pressed at together.
Can this be done and if so what do I need to change to achieve this?
EnablePrimaryMouseButtonEvents(true);
function OnEvent(event, arg)
if event == "MOUSE_BUTTON_PRESSED" and arg == 6 then
repeat
MoveMouseRelative(300,0)
Sleep(150)
MoveMouseRelative(-300,0)
Sleep(1500)
until event == "MOUSE_BUTTON_RELEASED" and arg == 6
elseif IsMouseButtonPressed(3) then
repeat
MoveMouseRelative(0,300)
Sleep(1000)
until not IsMouseButtonPressed(3)
end
end
Thanks in advance :D
Step 1.
Make sure you're not using MB#4 ("back") in the game.
If you don't use MB#4 in the game, just skip "Step 1".
If some action is assigned to MB#4 in the game, do the following:
F12
)F12
to your physical MB#4F12
instead of MB#4Now when you press physical MB#4, the game sees F12 and activates your old action.
Step 2.
Goto GHUB (SYSTEM tab)
Unbind "Back" from MB#4
Bind "Back" to MB#6
Step 3.
The script.
You should know that MoveMouseRelative() is limited by 127 pixels.
To move mouse cursor 300 pixels you should invoke it 3 times:
MoveMouseRelative(0,100);MoveMouseRelative(0,100);MoveMouseRelative(0,100)