Pause and restart when unpaused with one key Topic is solved

Ask gaming related questions (AHK v1.1 and older)
peped12
Posts: 2
Joined: 02 Dec 2023, 18:31

Pause and restart when unpaused with one key  Topic is solved

Post by peped12 » 02 Dec 2023, 18:41

I want it to always go restart when toggling pause/unpause, not resume where it was. Thanks in advance!

Code: Select all

$1::
Toggle := !Toggle
While Toggle{
    sleep 1530
    Send 1
    sleep 1507
    Send 1
    sleep 1540
    Send 1
    sleep 1509
    Send 3
}
E::Pause, Reload    ; Pause script with E
return
error text
1553315351.PNG
1553315351.PNG (6.98 KiB) Viewed 501 times

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

[Mod edit: Removed link to image that is already attached anyway and removed duplicate attachment.]

[Mod action: Moved topic to the v1 section since this is v1 code. The main section is for v2.]

User avatar
mikeyww
Posts: 27686
Joined: 09 Sep 2014, 18:38

Re: Pause and restart when unpaused with one key

Post by mikeyww » 02 Dec 2023, 20:31

Welcome to this AutoHotkey forum!

What does "restart" mean to you? What should "reload" do, and when?

Every command must exist on its own line; multiple commands cannot be combined on a single line. Example

peped12
Posts: 2
Joined: 02 Dec 2023, 18:31

Re: Pause and restart when unpaused with one key

Post by peped12 » 03 Dec 2023, 09:58

Figured it out, heres the final

Code: Select all

F1::
    Loop
    {
        myLabel_Start: ; Labels are basically Bookmarks for your script. You can jump to a Label with Goto/Gosub.

        If (myToggleVar=True)
        Goto myLabel_Start
send 1
sleep 1000
        If (myToggleVar=True)
            Goto myLabel_Start
send 1
sleep 1000
        If (myToggleVar=True)
            Goto myLabel_Start
send 1
sleep 1000
        If (myToggleVar=True)
            Goto myLabel_Start
send 3
sleep 1000       
        If (myToggleVar=True)
            Goto myLabel_Start
    }
Return

E:: myToggleVar := !myToggleVar ; E
[Mod edit: [code][/code] tags added.]

gregster
Posts: 9169
Joined: 30 Sep 2013, 06:48
Location: currently afk

Re: Pause and restart when unpaused with one key

Post by gregster » 03 Dec 2023, 10:06

@peped12, please use code tags around posted code. Markup like ``` won't work in this forum. Instead it uses BBCode.
Thank you!

ctags.png
ctags.png (14.2 KiB) Viewed 411 times

User avatar
mikeyww
Posts: 27686
Joined: 09 Sep 2014, 18:38

Re: Pause and restart when unpaused with one key

Post by mikeyww » 03 Dec 2023, 11:38

Instead of Goto for this script, you can use Continue.
Skips the rest of a loop statement's current iteration and begins a new one.

Post Reply

Return to “Gaming Help (v1)”