Page 1 of 1

Help with auto skill check

Posted: 31 May 2023, 07:33
by echoooo11
How would I make a program that presses (E) once the red part goes over the blue part

video of the skill check: https://imgur.com/GTkgkBQ
image of the skill check: https://imgur.com/a/nNzVDk4

Re: Help with auto skill check

Posted: 31 May 2023, 09:09
by boiler
It probably moves too fast for AHK to reliably work, but the approach would be to capture the blue part as a reference image (.png format) and color over all the non-blue pixels with another color that will be the one to ignore using ImageSearch's *Trans option. Then you would search until the image isn't found, which would be the indicator that the red has crossed into it because the full blue section cannot be found. At that point, you would perform Send "e" -- not a capital "E" because that would also send a Shift key along with a press of the E key.

Re: Help with auto skill check

Posted: 01 Jun 2023, 00:40
by echoooo11
boiler wrote:
31 May 2023, 09:09
It probably moves too fast for AHK to reliably work, but the approach would be to capture the blue part as a reference image (.png format) and color over all the non-blue pixels with another color that will be the one to ignore using ImageSearch's *Trans option. Then you would search until the image isn't found, which would be the indicator that the red has crossed into it because the full blue section cannot be found. At that point, you would perform Send "e" -- not a capital "E" because that would also send a Shift key along with a press of the E key.
how do u make the code tho, im new to this

Re: Help with auto skill check

Posted: 01 Jun 2023, 08:23
by boiler
I changed my mind and think your best chance at having this work given how fast it moves is to look for a red pixel in that area. You would do that with something like the code below. You would need to change the coordinates of the search rectangle to be one that encloses most the blue part of the circle and none of the other part. It will start searching when you press Ctrl+F1, although you can change how/when the search is initiated.

Code: Select all

^F1:: {
	while !PixelSearch(&FoundX, &FoundY, 100, 200, 130, 230, 0x912C50, 20)
		continue
	Send "e"
}

Re: Help with auto skill check

Posted: 01 Jun 2023, 21:30
by echoooo11
boiler wrote:
01 Jun 2023, 08:23
I changed my mind and think your best chance at having this work given how fast it moves is to look for a red pixel in that area. You would do that with something like the code below. You would need to change the coordinates of the search rectangle to be one that encloses most the blue part of the circle and none of the other part. It will start searching when you press Ctrl+F1, although you can change how/when the search is initiated.

Code: Select all

^F1:: {
	while !PixelSearch(&FoundX, &FoundY, 100, 200, 130, 230, 0x912C50, 20)
		continue
	Send "e"
}
problem with this is that the blue area moves each time, and its usually not that fast i think its just the video

Re: Help with auto skill check

Posted: 01 Jun 2023, 22:02
by boiler
I think the best way to find the position of the blue section would be to use PixelGetColor at spots that traverse the circle until you find one end of it. I think that's the easiest way, and you'll probably still find that pretty challenging. Once you find that, then you can do some calculations to determine the extents of the blue section, which would entail some not-so-straightforward math.

Re: Help with auto skill check

Posted: 02 Jun 2023, 01:35
by echoooo11
boiler wrote:
01 Jun 2023, 22:02
I think the best way to find the position of the blue section would be to use PixelGetColor at spots that traverse the circle until you find one end of it. I think that's the easiest way, and you'll probably still find that pretty challenging. Once you find that, then you can do some calculations to determine the extents of the blue section, which would entail some not-so-straightforward math.
:(

Re: Help with auto skill check

Posted: 02 Jun 2023, 04:09
by echoooo11
pls help me with it

Re: Help with auto skill check

Posted: 02 Jun 2023, 04:30
by boiler
Sorry. That’s way too involved of a script for me to “help” with. Based on your questions, I see I’d really be writing it. And I don’t even have the application to test with (and don’t want to).

Re: Help with auto skill check

Posted: 02 Jun 2023, 08:35
by echoooo11
boiler wrote:
02 Jun 2023, 04:30
Sorry. That’s way too involved of a script for me to “help” with. Based on your questions, I see I’d really be writing it. And I don’t even have the application to test with (and don’t want to).
hi i found this code, how different would i have to make it

Code: Select all

#NoEnv
dots1X := []
dots1Y := []
dots2X := []
dots2Y := []
i = 0
i2 := 0
c = 0
r = 70
en = 10
a := 0
while (i2 <= 360) {
	dots1X[i2] := Round(Cos(DegToRad(i2)) * r) + 963
	dots1Y[i2] := Round(Sin(DegToRad(i2)) * r) + 525
	i2 += en
}
loop {
	X := dots1X[a]
	Y := dots1Y[a]
	PixelGetColor, color, X, Y
	SplitRGBColor(color, Red, Green, Blue)
	if (Red >= 240) and (Green >= 240) and (Blue >= 240) {
		f = 1
		i += 1
		dots2X[i] := X
		dots2Y[i] := Y
	} else if (f = 1) {
		f = 0
		loop {
			c += 1
			if (c > i) {
				c = 1
			}
			PixelGetColor, color, dots2X[c], dots2Y[c]
			SplitRGBColor(color, Red, Green, Blue)
			if (Green <= 240) and (Blue <= 240) {
				if (255 >= Red) and (0 = Green) and (0 = Blue) {
					sendinput {space}
					break
				}
			} else {
				break
			}
		}
	}
	a += en
	if (a >= 361) {
		a = 0
	}
}
DegToRad(deg) {
	static degree := 0.01745329252
	return deg * degree
}
SplitRGBColor(RGBColor, ByRef Red, ByRef Green, ByRef Blue)
{
    Red := RGBColor >> 16 & 0xFF
    Green := RGBColor >> 8 & 0xFF
    Blue := RGBColor & 0xFF
}
[Mod edit: [code][/code] tags added. Please use them yourself going forward.]

Re: Help with auto skill check

Posted: 02 Jun 2023, 09:45
by boiler
I'm guessing it's not close to what you need, but you tell me. What what was said it is meant to do? You found the code but you provided no link, no description, and no context. Does it address this specific situation? Is it meant to find a line spinning around a circle when it crosses into a section of the circle which also appears in different parts of the circle?

Before you get your hopes up, which may be too late, just realize that someone who describes himself as "new to this" is not going to be able to grab some random code found on the internet and adapt it to what you need. And as I pointed out, it's more complex of a task than someone can help you complete via some forum posts. You need to find someone who knows how to code to spend some significant time directly with your app/game to develop and troubleshoot this. Unless you have a friend that can do this, you probably would need to hire someone, and it likely would cost the equivalent of hundreds of dollars for someone to want to take this on.

If the blue section isn't moving but just occasionally appears in different places, it should be possible to define the starting and ending point of the arc, and then you would just need to find if the position of the red line is within that arc or not. It makes it a little simpler, but it's not simple at all for someone new to coding and AHK, and it's not a simple thing for someone to advise you on from afar, even if it might not be that hard for them to do on their own if they had the game installed on their machine.