Sign in to follow this  
Followers 0
Combine

Help Pausing My Script

7 posts in this topic

Im trying to pause my script via a Hotkey this is what i have setup, i press o but it will not pause it.. it just keeps clicking and moving.

hotkeyset( "o" , "TogglePause" )
While 1
    WinActivate("CABAL")

$coord = PixelSearch( 100, 100, 1024, 718, 0xF3E80D, 50, 2)
If Not @error Then
  MouseMove($coord[0],$coord[1],0)
  MouseClick("left",$coord[0],$coord[1])
  Sleep (200)
EndIf
Send("{Right 4}")
Send("2")
Sleep(900)
Send("{Space}")
Send("{Right 4}")
Send("{Space}")
Send("{Right 4}")
Wend

Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
ToolTip("Paused", 0, 0)
WEnd
ToolTip("")
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Fixed it for you (You cannot use logical operators in variable assignment)

Global $paused=False
hotkeyset( "o" , "TogglePause" )
While 1
    WinActivate("CABAL")

$coord = PixelSearch( 100, 100, 1024, 718, 0xF3E80D, 50, 2)
If Not @error Then
  MouseMove($coord[0],$coord[1],0)
  MouseClick("left",$coord[0],$coord[1])
  Sleep (200)
EndIf
Send("{Right 4}")
Send("2")
Sleep(900)
Send("{Space}")
Send("{Right 4}")
Send("{Space}")
Send("{Right 4}")
Wend

Func TogglePause()
If $paused=False THen 
    $paused=True
Else
    $paused=False
EndIf

    

While $Paused
Sleep(100)
ToolTip("Paused", 0, 0)
WEnd
ToolTip("")
EndFunc
Edited by monoceres

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

hmm its still clicking around were the color its set to click is =x not pausing, i maining want to pause it so it wont mess up another script that i have set to run every 45 minutes. i was thinking i would just pause it long enough so the other script would go about what its ment to and by the time its done the script i paused would be unpaused. i've tried making so it Exits on a hotkey and have the other script run it before it sleeps for another 45 minutes but it wouldnt exit either.

Edited by Combine

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can use the not keyword in a variable assignment. All you needed to do was declare your Paused variable, globally.

(It seems to work fine for me)

Edited by cppman

Share this post


Link to post
Share on other sites

im running this as a bot that clicks a monster in Cabal a MMORPG, when i press the key set to pause it, it just continues to keep clicking

Share this post


Link to post
Share on other sites

Oh I had no idea, I just assumed it couldn't be done since I got a warning


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

If i cant get it to pause would it be possible to put this other script im pausing the above one for into it so that it will go off every 45 minutes and do its stuff and then resume the rest of the script?

Opt("WinWaitDelay", 100)
Opt("WinTitleMatchMode", 4)
Opt("WinDetectHiddenText", 1)
Opt("PixelCoordMode", 2)
Opt("MouseCoordMode", 2)
WinWait("CABAL", "")
If Not WinActive("CABAL", "") Then WinActivate("CABAL", "")
WinWaitActive("CABAL", "")
$title_b = "CABAL"
$Process = WinGetProcess($title_b, "");Open process
$repeat = 0

Do
Send("o")
MouseMove(803,406)
MouseClick("left")
sleep(10)
send("2")
sleep(10000)
Send("{ENTER}")
sleep(2700000)
Until $repeat = 1
Edited by Combine

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0