HelpRequest: Simple AHK Script.

Posts 1–7 of 7 · Page 1 of 1
Request: Simple AHK Script.
So I feel tired of spamming my mouse2 as a Tomb Raiser, anyone can make a simple script that when you press a key, it automatically presses mouse2 every 0.1s, and when you press again, it stops.

Something like this:

*Press X*
Mouse2()
Mouse2()
...
*Press X again*
Stop()
Sorry for my english .
In autoit, just change whatever you need the mouse button(s) to be. As it is here, clicking the mouse wheel will toggle on/off spamming the left mouse button. You can easily change whatever key/button you're spamming as well as they toggle key. GL



HotKeySet("{END}", "ForceEnd")
DeclareGlobals()
Local $hDLL = DllOpen("user32.dll")
While 1
If _IsPressed("04", $hDLL) Then
ToggleSpamLClick()
EndIf
If $SpamLClick=1 Then
MouseClick("Left")
EndIf
Sleep(80)
WEnd
Func ToggleSpamLClick()
If $SpamLClick=0 Then
$SpamLClick=1
For $click=1 to 5
MouseClick("Left")
sleep(80)
Next
Else
$SpamLClick=0
Sleep(500)
EndIf
EndFunc
Func DeclareGlobals()
Global $SpamLClick=0
EndFunc
Func ForceEND()
Exit
EndFunc
Tyvm but when I run this script, it says there is an error on line 3.
@zminh1 ok this is really simple everytime you hit Alt it will spam right mouse 5 times and it will reload the script itself so you can just alt everytime you want to spam mouse2. Tell me if it works for you. BTW this is in AutoHotKey.

Code:
#WinActivateForce

Alt::
	Counter := 0
	
	While Counter = 0
		{
			Loop	
			{
				MouseClick, right
				if Counter = 5
				{
					Break
				}
				Sleep, 80
				Counter++
			}
		}
	Counter := 0
	Reload
	
Return
Here is my shot at it with my stop and start timer that I wrote for alot of my stuff.


To use F1 to start you will hear 1 ding. Then F1 again to stop you will hear 2 Dings.
Code:
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
SetKeyDelay 10,50

AutoMouseClick = off



F1::
		If AutoMouseClick = off
			{
				AutoMouseClick = on
				SetTimer, AutoMouseClick, 100
				Ticks := 0
				SoundPlay, %A_WinDir%\Media\Windows Ding.wav
			} else 	If AutoMouseClick = on
			{

			  AutoMouseClick = off
			  SetTimer, AutoMouseClick, Off
		  	SoundPlay, %A_WinDir%\Media\Windows Ding.wav
        sleep 100
        SoundPlay, %A_WinDir%\Media\Windows Ding.wav
			}
return


AutoMouseClick:
 MouseClick, right
return
Quote Originally Posted by taejim View Post
@zminh1 ok this is really simple everytime you hit Alt it will spam right mouse 5 times and it will reload the script itself so you can just alt everytime you want to spam mouse2. Tell me if it works for you. BTW this is in AutoHotKey.

Code:
#WinActivateForce

Alt::
	Counter := 0
	
	While Counter = 0
		{
			Loop	
			{
				MouseClick, right
				if Counter = 5
				{
					Break
				}
				Sleep, 80
				Counter++
			}
		}
	Counter := 0
	Reload
	
Return
With this, When your in battle you hit ALT and it will right click 5 times, (Sends out your 5 minions), Then when your energy is regen, You can hit ALT again and it will repeat sending out 5 minions? (It automatically after pushing ALT with start script, and automatically stop. Until you hit ALT again?) I would have a hard time remembering to toggle it on / off.
Opps miss post
Posts 1–7 of 7 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us