Jump to content

Adding script reset


Recommended Posts

Hello, I've been using this template with pause and terminate hotkey for some time now.  I'm hoping someone can help me add a reset function that will restart the script to the beginning with a hotkey.  Thanks a lot!

 

 ; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{NUMPAD0}", "TogglePause")
HotKeySet("{numpad1}", "Terminate")
HotKeySet("+!d", "ShowMessage") ;Shift-Alt-d
While 1
Sleep(10)
Send('{backspace}')
Sleep(100)
Send('{ESC}')
Sleep(100)

Sleep(50)
Send('{numpad0}')
Sleep(50)
Send('{space}')
Sleep(50)
WEnd
While 1
    MsgBox (0, "Pause ;-)")
    Sleep (2000)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('"Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

Script.au3

Link to comment
Share on other sites

4 minutes ago, 232showtime said:

what app you are automating?

I've been using this for grinding in sp d2 with my own basic movement scripts.  Hand can get tired so its nice to have the script do the manual work and I just ID stuff.

Link to comment
Share on other sites

Put whatever you want to Restart in a function body.

Up at your list of HotKeySet()s add a new key and the name of your new function.

Now when you press the new key your function will be called again (Just like restarting).

Something like this

<snip>

Edited by JLogan3o13
Link to comment
Share on other sites

Thanks Xandy, it works great but I notice that when I use the reset button the script seems to ignore the auto pause I put in the script.  I use numbpad0 to pause and inserted send for it in the script but reset seems to ignore it, but it does stop at the end of the script.  Is there any fix for this?

<snip>

Edited by JLogan3o13
Link to comment
Share on other sites

  • Moderators
8 hours ago, Lentil said:

I've been using this for grinding in sp d2 with my own basic movement scripts.

Care to explain exactly what sp d2 is please?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

I figured as much. You seem to have walked right by our forum rules on your way in. Please read them now, especially the part about game automation, and you'll see why this thread is locked. You will get no help on this subject.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...