Need help.

Ask gaming related questions (AHK v1.1 and older)
Octavia
Posts: 1
Joined: 27 Mar 2017, 20:06

Need help.

27 Mar 2017, 20:10

How would i begin to make a script like this?

https://www.youtube.com/watch?v=n3TytnZNL08&t=6s

Thanks
User avatar
Spawnova
Posts: 554
Joined: 08 Jul 2015, 00:12
Contact:

Re: Need help.

29 Mar 2017, 03:50

One option is to use Pixelsearch to match the yellow edge of the inner backboard, take an image of the window and find the width/height of the yellow outline and you now have the x,y,w,h of the backboard, the rest is just some math and clicks

Here's some example code, keep in mind this script is basically pseudocode, use it as a guideline.

Code: Select all

;80,80 is an example, use the found width/height of the yellow outline
backboardWidth := 80
backboardHeight := 80
;Define a rectangle to search the pixel in, basically 
searchX := 10 ;top left pixel to start search, change these values to fit the screen
searchY := 10
searchX2 := searchX + 400 ;search from top left pixel outwards 400 pixels width and 1000 pixels height
searchY2 := searchY + 1000
return

f1::
;fast parameter is important here because it searches from the top to the bottom, left to right so the pixel if found will always be the top left pixel
pixelsearch,outputX,outputY,%searchX%,%searchY%,%searchX2%,%searchY2%,0xFFFF00,10,fast rbg ;0xFFFF00 = yellow color, 10 = variation
if (errorlevel == 0) { ;outputs 0 if color is found
	middleX := outputX + (backboardWidth / 2) ;click in the middle of the backboard
	middleY := outputY + (backboardHeight / 2)
	click,%middleX%,%middleY%
} else { ;no match
	msgbox no yellow pixel found
}
return

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 95 guests