Jump to content

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

[Help] How to add pause script.


  • Please log in to reply
6 replies to this topic
deathangel
  • Members
  • 4 posts
  • Last active: May 19 2013 11:06 AM
  • Joined: 18 May 2013

I write this code for auto game Forsaken World, First times i use AHK, I want while i press Alt+P, script will pause and while i press Alt+P again, script will unpause. But i don't know how to add Pause script to this code. Any body can help me add Pause script to this code to have working script? Pls.

(sorry about my English, i'm bad with english)

MButton::
	KeyWait, MButton
	Suspend On
	WinActivate, Forsaken World - Aria - Realm 2

loop
{
	loop, 5
	{
		loop, 10
		{
			Send, {Tab}  
			Sleep, 200
			loop, 3
			{
				Send, 1
				Sleep, 1000
				Send, 2
				Sleep, 1000
				Send, 3
				Sleep, 1000
				Send, 5
				Sleep, 2000
			}	
		}
		Sleep, 1000
		Send, 7
		Sleep, 1000
	}
	Sleep, 1000
	Send, 6
	Sleep, 1000
}
Suspend, Off
Return ;



JadeDragon
  • Members
  • 935 posts
  • Last active: Jun 07 2014 07:40 AM
  • Joined: 18 Jan 2013
!p::Pause, toggle

Never assume evil intent when simple ignorance will suffice. Ignorance is an eventually curable condition with the right education. Evil intent, however, is another matter entirely. Scripts are much like children. Simple to conceive. Difficult, expensive, and time-consuming to raise. Often do the opposite of what you expect them to. Require frequent  "correction". And once they leave home you can't control them anymore. But you love them anyway.


deathangel
  • Members
  • 4 posts
  • Last active: May 19 2013 11:06 AM
  • Joined: 18 May 2013

where i can write it?

i'm try 

!p::pause, toggle
MButton::
	KeyWait, MButton
	Suspend On
	WinActivate, Forsaken World - Aria - Realm 2

loop
{
	loop, 5
	{
		loop, 10
		{
			Send, {Tab}  
			Sleep, 200
			loop, 3
			{
				Send, 1
				Sleep, 1000
				Send, 2
				Sleep, 1000
				Send, 3
				Sleep, 1000
				Send, 5
				Sleep, 2000
			}	
		}
		Sleep, 1000
		Send, 7
		Sleep, 1000
	}
	Sleep, 1000
	Send, 6
	Sleep, 1000
}
Suspend, Off
Return ;

but this not work, script didn't pause when i was pressing Alt+P



JadeDragon
  • Members
  • 935 posts
  • Last active: Jun 07 2014 07:40 AM
  • Joined: 18 Jan 2013

because you have suspend turned on you may need to try this instead

!p::
Suspend Permit
Pause, Toggle
Return

And you may need to comment out the Suspend, on line, in the Mbutton hotkey code.


Never assume evil intent when simple ignorance will suffice. Ignorance is an eventually curable condition with the right education. Evil intent, however, is another matter entirely. Scripts are much like children. Simple to conceive. Difficult, expensive, and time-consuming to raise. Often do the opposite of what you expect them to. Require frequent  "correction". And once they leave home you can't control them anymore. But you love them anyway.


deathangel
  • Members
  • 4 posts
  • Last active: May 19 2013 11:06 AM
  • Joined: 18 May 2013
!p::
Suspend Permit
Pause, Toggle
Return

MButton::
	KeyWait, MButton
	WinActivate, Forsaken World - Aria - Realm 2

loop
{
	loop, 5
	{
		loop, 10
		{
			Send, {Tab}  
			Sleep, 200
			loop, 3
			{
				Send, 1
				Sleep, 1000
				Send, 2
				Sleep, 1000
				Send, 3
				Sleep, 1000
				Send, 5
				Sleep, 2000
			}	
		}
		Sleep, 1000
		Send, 7
		Sleep, 1000
	}
	Sleep, 1000
	Send, 6
	Sleep, 1000
}
Return

When i was pressing Alt+P, script paused, but when i was pressing again, script didn't unpause...pls help me...i'm bad with programing >"<



JadeDragon
  • Members
  • 935 posts
  • Last active: Jun 07 2014 07:40 AM
  • Joined: 18 Jan 2013
MaxThreadsPerHotkey 2 ;<-- added

!p::
Suspend Permit
keywait, p   ;<-- added
Pause, Toggle
Return

MButton::
	KeyWait, MButton
	WinActivate, Forsaken World - Aria - Realm 2

loop
{
	loop, 5
	{
		loop, 10
		{
			Send, {Tab}  
			Sleep, 200
			loop, 3
			{
				Send, 1
				Sleep, 1000
				Send, 2
				Sleep, 1000
				Send, 3
				Sleep, 1000
				Send, 5
				Sleep, 2000
			}	
		}
		Sleep, 1000
		Send, 7
		Sleep, 1000
	}
	Sleep, 1000
	Send, 6
	Sleep, 1000
}
Return

Never assume evil intent when simple ignorance will suffice. Ignorance is an eventually curable condition with the right education. Evil intent, however, is another matter entirely. Scripts are much like children. Simple to conceive. Difficult, expensive, and time-consuming to raise. Often do the opposite of what you expect them to. Require frequent  "correction". And once they leave home you can't control them anymore. But you love them anyway.


deathangel
  • Members
  • 4 posts
  • Last active: May 19 2013 11:06 AM
  • Joined: 18 May 2013

It working. Ty for your help.