macro script help

Ask gaming related questions
chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

macro script help

20 Oct 2013, 17:20

Ok. so I am trying to make it so when the first image is found, it press 5 then waits 18sec before ever pressing 5 again. But During that 18sec I want it to repeat the other 4 actions. then after the 18sec have it all start over again from the beginning for another 18sec all when I hold down the 2 key.
Spoiler
chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

Re: macro script help

22 Oct 2013, 13:00

Ok well never mind because I can't get the Image search to work while playing SWTOR lol works on a screenshot but not in game.
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: macro script help

22 Oct 2013, 13:18

Try ImageSearch while you're playing in Windowed Fullscreen mode, instead of just Fullscreen.

Instead of Sleep or Wait, use SetTimer instead.
http://ahkscript.org/docs/commands/SetTimer.htm
chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

Re: macro script help

22 Oct 2013, 15:41

Thanks for the set timer tip but it easer to just press the 5. lol Ok so this is what I got working. Only one problem as soon as it can't find an image instead of it just looking for the next image and pressing it's key it just stops, and then I have to start the script over. Any ideas why
Spoiler
User avatar
Grendahl
Posts: 159
Joined: 30 Sep 2013, 08:21

Re: macro script help

23 Oct 2013, 07:43

I'd suggest adding a mousemove right after your imagesearches, as well as a traytip to display the errorlevel to help you troubleshoot. (they can be removed later)

What does running this show you?

Code: Select all

CoordMode, Pixel, Window ;this just needs to be in the script once. (at the top)

$2::
While %A_ThisHotkey% { 

	Image1 := "C:\Users\ASUS\AppData\Roaming\MacroCreator\Screenshots\Screen_20131022160315.png"
	ImageSearch, FoundX1, FoundY1, 296, 793, 804, 892, *10 %Image1%
	If(ErrorLevel>0) { ; if we have anything other than success, give a notification, show our vars, and break out of the loop.
		TrayTip,Error,ImageSearch failed for %Image1%`nErrorLevel = %ErrorLevel%
		ListVars ; just here for debugging
		Break
	}
	MouseMove, %FoundX1%, %FoundY1% ; just here for debugging
	Sleep, 200
	Send, 7
	Sleep, 1510
	
	Image2 := "C:\Users\ASUS\AppData\Roaming\MacroCreator\Screenshots\Screen_20131022155405.png"
	ImageSearch, FoundX2, FoundY2, 578, 839, 635, 889, *10 %Image2%
	If(ErrorLevel>0) { ; if we have anything other than success, give a notification, show our vars, and break out of the loop.
		TrayTip,Error,ImageSearch failed for %Image2%`nErrorLevel = %ErrorLevel%
		ListVars ; just here for debugging
		Break
	}
	MouseMove, %FoundX2%, %FoundY2% ; just here for debugging
	Sleep, 200
	Send, 8
	Sleep, 1510
	
	Image3 := "C:\Users\ASUS\AppData\Roaming\MacroCreator\Screenshots\Screen_20131022162424.png"
	ImageSearch, FoundX3, FoundY3, 294, 792, 819, 893, *10 %Image3%
	If(ErrorLevel>0) { ; if we have anything other than success, give a notification, show our vars, and break out of the loop.
		TrayTip,Error,ImageSearch failed for %Image3%`nErrorLevel = %ErrorLevel%
		ListVars ; just here for debugging
		Break
	}
	MouseMove, %FoundX3%, %FoundY3% ; just here for debugging
	Sleep, 200
	Send, 4
	Sleep, 1510
	
	Image4 := "C:\Users\ASUS\AppData\Roaming\MacroCreator\Screenshots\Screen_20131022161739.png"
	ImageSearch, FoundX4, FoundY4, 291, 789, 823, 893, *10 %Image4%
	Sleep, 200
	If(ErrorLevel>0) { ; if we have anything other than success, give a notification, show our vars, and break out of the loop.
		TrayTip,Error,ImageSearch failed for %Image4%`nErrorLevel = %ErrorLevel%
		ListVars ; just here for debugging
		Break
	}
	MouseMove, %FoundX4%, %FoundY4% ; just here for debugging
	Sleep, 200
	Send, 1
	Sleep, 1510
	
	Image5 := "C:\Users\ASUS\AppData\Roaming\MacroCreator\Screenshots\Screen_20131022161650.png"
	ImageSearch, FoundX5, FoundY5, 297, 795, 813, 892, *10 %Image5%
	If(ErrorLevel>0) { ; if we have anything other than success, give a notification, show our vars, and break out of the loop.
		TrayTip,Error,ImageSearch failed for %Image5%`nErrorLevel = %ErrorLevel%
		ListVars ; just here for debugging
		Break
	}
	MouseMove, %FoundX5%, %FoundY5% ; just here for debugging
	Sleep, 200
	Send, 6
	Sleep, 1510
}
chris114
Posts: 8
Joined: 20 Oct 2013, 14:36

Re: macro script help

24 Oct 2013, 12:06

hey it's ok the game just does not let image\pixel search work right. but thank you for your help.

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 13 guests