how do two scripts not run together, but alternately ?

Ask gaming related questions (AHK v1.1 and older)
rickyang11
Posts: 10
Joined: 24 Jan 2021, 17:50

how do two scripts not run together, but alternately ?

Post by rickyang11 » 28 Jan 2021, 10:14

I'm sorry for my english. So, as you can see from title, i want make 2 script not running together, at firs script 1 running after that script 2 running while script 1 off. After that back to script 1 again. is there anyaway to do it ?

this is myy 2 script that i want to make running separately.

Code: Select all

CoordMode Pixel

; Script 1

   pRun := !pRun
   If (!pRun)
Return
	
	while (pRun)
		
{	PixelGetColor := false
	while(PixelGetColor = false)
	{
		PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0x15E005, 0, fast
		if(x <> "")
		{
			Send, {Space}
			PixelGetColor := true
		}
	}
}

 ; Script 2

   pRun := !pRun
   If (!pRun)
Return
	
	while (pRun)
		
{	PixelGetColor := false
	while(PixelGetColor = false)
	{
		PixelSearch, x, y, 0, 0, A_ScreenWidth, A_ScreenHeight, 0x3A9D5D, 0, fast
		if(x <> "")
		{
			Send, {Space}
			PixelGetColor := true
			Sleep, 4000
			MouseClick, Left, 542, 467
			Sleep, 1500
			MouseClick, Left, 500, 400, 3 
	
		}
	}
}

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

Re: how do two scripts not run together, but alternately ?

Post by mikeyww » 28 Jan 2021, 16:04

A bit confusing: pRun becomes True. The first While loop then runs. What stops it?

Post Reply

Return to “Gaming Help (v1)”