Instructions
Open and define your script by using the following code:
~RButton::
loop
{
This will open a script that will work when you press the right button on your mouse. You may substitute "RButton" for any mouse button. For example, to bind this script to the left mouse button, substitute "Rbutton" with "LButton."
Define the timing between actions when you hold down the button by entering the following code:
Sleep 0.0001
This sets the delay between clicks. The time is set in milliseconds and may be changed depending on how often you wish to fire your weapon when you hold the button down.
Define the script's action by using the following code:
GetKeyState, RButtonState, RButton, P
This tells the script to see if the right mouse button is pressed, and if it is, to continually enact the action assigned to the right mouse button in the game. Again, you may substitute the right mouse button for any button on your mouse.
Tell the script to terminate when you release the button by using the following code:
if RButtonState = U
break
MouseClick, right
This tells the script to stop when the button is released. You may substitute "RButton" for any button on your mouse.
End the scripts by using the following code:
}
return
Bring the entire script together. For example, if you were using the right mouse button for your autofire script, the entire script would look like this:
~RButton::
Loop
{
Sleep 0.0001
GetKeyState, RButtonState, RButton, P
if RButtonState = u
break
MouseClick, Right
}
return