Hello,
My rotation consists of pressing 4 4 4 Q, however sometimes I need to pause this rotation quickly and press another key for some other skill.
What I want is to assign MButton (the same button that starts the macro) to pause the script. And I want macro to start from where it left when I press MButton again.
Here is the current macro I'm using.
MButton::
Send, {4}
Sleep, 1200
Send, {4}
Sleep, 1200
Send, {4}
Sleep, 1250
Send, {q}
return
Already now thanks for your help.
Pausing a rotation script at the middle
Started by
Tegas
, Jul 19 2012 09:29 AM
2 replies to this topic
#1
Posted 19 July 2012 - 09:29 AM
#2
Posted 19 July 2012 - 12:51 PM
Untested :!:
MButton:: ; Toggle On/Off
Var := !Var
If Var = 1
SetTimer, Timer, On
Else
SetTimer, Timer, Off
return
Timer: ; Code to execute
Send, {4}
Sleep, 1200
Send, {4}
Sleep, 1200
Send, {4}
Sleep, 1250
Send, {q}
return
#3
Posted 21 July 2012 - 12:33 AM
#NoEnv
#SingleInstance, Force
#Persistent
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetBatchLines, -1
SetKeyDelay, 50,50
DetectHiddenWindows, On
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, Tooltip, Screen
; skill list holds key,sleep,key,sleep,key,sleep,...,key,sleep
skilllist = 4,1200,4,1200,4,1250,q,50 ;key list with variable sleeps
StringSplit, skillary, skilllist, `, ;<-- turn list into an array
SKitemcount := skillary0
SKidx := 0
MBRunningHot := 0
Return
;------------------------------------------------
; this hotkey will loop through the skilllist until one of two
; conditions exist. 1) User presses the esc key to exit the loop
; or 2) User presses the middle mouse button to interrupt the
; loop. In the event the user interrupts the loop and restarts
; it using the middle mouse button, the routine will pick up
; from where it was interrupted and continue looping.
; NOTE: because there are sleeps in the skill list, pressing the
; middle mouse button may not register right away. Hold the middle
; button until you hear the beep then release the button.
;------------------------------------------------
MButton::
If (MBRunningHot) ;<-- for reentry
goto MBHot
SKidx := 0 ;<-- if starting from the beginning
MBNextItem:
SKidx++
MBHot:
Suspend, On ;<-- disallow mbutton hotkey
If (GetKeyState("MButton", "P"))
{ MBRunningHot := 1 ;<-- so routine knows where to resume
soundbeep 750,200 ;<-- one beep for hold
Suspend, Off ;<-- allow hotkeys again
Return
}
If (GetKeyState("Esc", "P"))
{ MBRunningHot = 0 ;<-- so list can start over
Soundbeep, 750, 200 ;<-- two beeps for exit
SoundBeep, 750, 200
Suspend, Off
Return
}
if (SKidx > SKitemcount) ;<-- if end of list...
SKidx := 1 ;<-- restart from the beginning
SKturn := Mod(SKidx,2) ;<-- turn shows key or sleep
SKitem := skillary%SKidx% ;<-- get the item to send or sleep
if (SKturn) ;<-- if turn is 1 it's a key
Send, %SKitem%
else ;<-- otherwise it's a sleep
Sleep, %SKitem%
Goto MBNextItem
This routine was tested in notepad and works. I will not guarantee it will work in your game.




