complex Posted September 28, 2009 Share Posted September 28, 2009 Hello again, I have looked around, but no luck with the search. I have one loop which is the main driver of the program. In the loop the choice of what spell to cast is made based off a few different elements such as Duration, CoolDown, and Mana. Currently the loop triggers when ever I hit {PAUSE} on my keyboard. I'm not 100% sure hot to make the same key toggle it off, but I have seen on the forums, and will search for that one a little later. What I would like to do is to have some of the var's reset every time if turn the loop off, namely Mana and Duration[0-5]. expandcollapse popupHotKeySet("{PAUSE}", "TogglePause") HotKeySet("{ESC}", "Terminate") Run("notepad.exe") WinWaitActive("Untitled - Notepad") While 1 Select case $Mana >= 2729 send("{t}") $Mana += $Spells[0][2] If $Mana < 0 Then $Mana = 0; $Duration[0] = $Spells[0][3] CoolDonws($Spells[0][1]) Sleep($Spells[0][1]) case $Duration[1] <= 0 send("{1}") $Mana += $Spells[1][2] $Duration[1] = $Spells[1][3] If $Duration[2] > 0 Then $Duration[2] = $Spells[2][3] CoolDonws($Spells[1][1]) Sleep($Spells[0][1]) case $Duration[2] <= 0 send("{2}") $Mana += $Spells[2][2] $Duration[2] = $Spells[2][3] CoolDonws($Spells[2][1]) Sleep($Spells[0][1]) case $Duration[3] <= 0 send("{3}") $Mana += $Spells[3][2] $Duration[3] = $Spells[3][3] CoolDonws($Spells[3][1]) Sleep($Spells[0][1]) case $Duration[4] <= 0 send("{4}") $Mana += $Spells[4][2] $Duration[4] = $Spells[4][3] CoolDonws($Spells[4][1]) Sleep($Spells[0][1]) case $Duration[5] <= 0 send("{5}") $Mana += $Spells[5][2] $Duration[5] = $Spells[5][3] CoolDonws($Spells[5][1]) Sleep($Spells[0][1]) EndSelect WEnd ;;;;;;;; Func CoolDonws($cd) For $i = 0 to 5 $Duration[$i] -= $cd Next EndFunc Func TogglePause() $Paused = NOT $Paused While $Paused sleep(100) ToolTip('Script is "Paused"',0,0) WEnd ToolTip("") EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Nutster Posted September 28, 2009 Share Posted September 28, 2009 (edited) What you need to do is put the sleeper loop inside your other loop; I recommend at the bottom of the loop, between the EndSelect and the Wend. EndSelect While $Pause Sleep(100) Wend Wend Func TogglePause() Local $I If $Paused Then ToolTip("") $Mana = 0; For $I = 0 To 5 $Duration[$I] = 0 Next $Paused = False ; Restarting things Else $Paused = True ToolTip('Script is "Paused"',0,0) ; This should not be executed a whole bunch of times. Endif EndFunc Edited September 28, 2009 by Nutster David NuttallNuttall Computer Consulting An Aquarius born during the Age of Aquarius AutoIt allows me to re-invent the wheel so much faster. I'm off to write a wizard, a wonderful wizard of odd... Link to comment Share on other sites More sharing options...
complex Posted September 28, 2009 Author Share Posted September 28, 2009 EndSelect While $Pause Sleep(100) Wend Wend Func TogglePause() Local $I If $Paused Then ToolTip("") $Mana = 0; For $I = 0 To 5 $Duration[$I] = 0 Next $Paused = False ; Restarting things Else $Paused = True ToolTip('Script is "Paused"',0,0) ; This should not be executed a whole bunch of times. Endif EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now