I've given my best shot at this, piecing together bits of code to try and make something work... And so far I've it it to do what I want, just not at the same time.
I've got two things that need to happen:
1. Spam 2, 3 and 4 with a random range (40 to 70)
2. Right click every 16 seconds.
So far I've managed to get it so I can toggle these two things on and off, but I can't get them to run at the same time. I tried to play around with a label1, label2 sort of thing.... But it really didn't work well (I had to reboot my PC because it kept right clicking everywhere). I tried fixing this several times, but pretty sure I just butchered an already pieced together code.
Any pros out there able to help?
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
#InstallMouseHook
#MaxThreadsPerHotkey 2
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
toggle = 0
chatopen = 0
voiceopen = 0
_ran(min, max)
{
random, ran, %min%, %max%
return ran
}
#IfWinActive, Diablo III
$~Enter::
If toggle {
chatopen := !chatopen
}
return
#IfWinActive, Diablo III
$~/::
If !chatopen and toggle {
chatopen := !chatopen
}
return
#IfWinActive, Diablo III
F8::
toggle := !toggle
While toggle {
If !chatopen {
ControlSend, , {Blind}2, Diablo III
ControlSend, , {Blind}3, Diablo III
ControlSend, , {Blind}4, Diablo III
MouseClick Left
sleep, % _ran(40, 70)
}
}
return
#IfWinActive, Diablo III
F7::
toggle := !toggle
While toggle {
If !chatopen {
MouseClick Left, Diablo III
sleep, 16000
}
}
return
Escape::
ExitApp
Return