Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Pause and unpause


  • Please log in to reply
4 replies to this topic
Up n Adam
  • Members
  • 3 posts
  • Last active: Aug 14 2011 11:49 AM
  • Joined: 14 Aug 2011
I only use quite basic functions of Autohotkey for an online game I play to send text for chat and commands, so i'll try and explain this the best I can

I know that you can pause and unpause a script, I know that you can asign a key to do it e.g

pause::
pause

And I know about sleep to pause/delay for a set amount of time

What I want though is to activate a hotkey so it'll send some text which is obviously easy, but I want it to send a couple of lines of text and then pause, which i've managed to do, then I want to be able to manually put a players ID number in after the word "eject", then when I unpause I want it to continue with the rest of the script

I tried assigning the pause key to pause and unpause the script, I activated the hotkey and it sent the text and paused like I wanted it to but when I pressed pause to unpause the script and carry on it restarted the hotkey from the start again and repaused after "eject" again, how do I prevent this from happening and make it carry on from after the word pause?

!e::
sleep, 200
send t/me leans over and flings the passenger door open{enter}
sleep, 500
send t/me shoves the passenger out{enter}
sleep, 200
send t/eject
pause
; This is where I want it to continue from when I unpause
send {enter}
send t/s ask to get in next time{enter}
return

Just to make it a little more complicated haha, i'd quite like to be able to press Enter after putting the ID in to enter the text into the game and then automatically unpause the script, but only while that specific hotkey is activated so enter doesn't alway pause and unpause my script everytime I press Enter during the game

I hope all that made some kind of sense :)

Lexikos
  • Administrators
  • 9844 posts
  • AutoHotkey Foundation
  • Last active:
  • Joined: 17 Oct 2006

pause::
pause

Hotkeys should be written using one of the following forms:
key::single command
key::
one or more commands
[color=red]return[/color]
...and make sure not to put it inside your !e hotkey.

If that doesn't help, post your complete script - include both hotkeys in one code block. :)

Up n Adam
  • Members
  • 3 posts
  • Last active: Aug 14 2011 11:49 AM
  • Joined: 14 Aug 2011
OMG such a basic mistake IDK why I did the pause key like that

pause::pause worked great thank you :D

It's not important because i'm pretty happy to press pause to restart the hotkey but is there a way to press return and it unpauses the hotkey but only while that specific hotkey is running? If that makes sense

spg SCOTT
  • Members
  • 115 posts
  • Last active: Apr 20 2012 04:41 PM
  • Joined: 10 Jun 2011
Maybe Keywait?

<!-- m -->http://www.autohotke...nds/KeyWait.htm<!-- m -->
!e::
sleep, 200
send t/me leans over and flings the passenger door open{enter}
sleep, 500
send t/me shoves the passenger out{enter}
sleep, 200
send t/eject
;~ pause <-- Not needed.
; // At this point you would enter the name you wanted. Then press enter.
keywait, Enter, D ; // Will wait until the Enter key is pressed then continue with the script.
; This is where I want it to continue from when I unpause
send {enter}
send t/s ask to get in next time{enter}
return

“There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them!” Richard Feynman

Up n Adam
  • Members
  • 3 posts
  • Last active: Aug 14 2011 11:49 AM
  • Joined: 14 Aug 2011
Yaaay both methods work a treat, brilliant, thank you both for your help