hello guys, i have a big problem to create a script and would like some help, it is a script that works with pixelsearch and also imagesearch
let's go to the explanation:
first he checks the coordinates
X = 680
Y = 25
until
X = 1000
Y = 40
in search of color
0x8F00B7 = PURPLE COLOR
if that color is found no action is taken,
more if the color is not found, it looks for an image in the coordinates
X = 530
Y = 578
until
X = 580
Y = 600
and if found, press the "END" key
script pixel and image check
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
script pixel and image check
Last edited by BoBo on 19 Feb 2021, 16:18, edited 1 time in total.
Reason: Moved to Gaming section.
Reason: Moved to Gaming section.
Re: script pixel and image check
Code: Select all
PixelSearch,,, 680, 25, 1000, 40, 0xB7008F,, Fast ; Blue, green, red
If !ErrorLevel
Return
ImageSearch,,, 530, 578, 580, 600, [image] ; Provide path to image
Send % ErrorLevel ? "" : "{End}"
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
Re: script pixel and image check
I tested more it didn't work
I will put a picture of the game and do a more detailed explanation
[image] https://imgur.com/a/fCDRF8d
first the script tests whether the purple color bar at the top of the photo is found,
(which is marked in red) and if found, no action should be taken,
but the purple bar has a link to the image (which is marked in red) at the bottom of the photo
the image at the bottom represents a waiting time to be able to use the purple bar again,
now i will explain how i would like the script to work again:
first it is checked if the purple color is found in that position. X = 680 Y = 25 until X = 1000 Y = 40
if it is found no action is taken.
if not found
there it is checked if the image is active, (when the image is active the same in the photo is because I can't activate the purple bar again)
coordenate image : X = 530 Y = 578 until X = 580 Y = 600
however if the image is active, I would like to press the "END" key that makes the image disappear immediately, thus making it possible to activate the purple bar.
(I will activate the purple bar manually)
I would like this check to happen every 1 second,
the image path is this:
C:\Users\ Alex\ Desktop\images
image link: https: //imgur.com/a/8lycUlz
I will put a picture of the game and do a more detailed explanation
[image] https://imgur.com/a/fCDRF8d
first the script tests whether the purple color bar at the top of the photo is found,
(which is marked in red) and if found, no action should be taken,
but the purple bar has a link to the image (which is marked in red) at the bottom of the photo
the image at the bottom represents a waiting time to be able to use the purple bar again,
now i will explain how i would like the script to work again:
first it is checked if the purple color is found in that position. X = 680 Y = 25 until X = 1000 Y = 40
if it is found no action is taken.
if not found
there it is checked if the image is active, (when the image is active the same in the photo is because I can't activate the purple bar again)
coordenate image : X = 530 Y = 578 until X = 580 Y = 600
however if the image is active, I would like to press the "END" key that makes the image disappear immediately, thus making it possible to activate the purple bar.
(I will activate the purple bar manually)
I would like this check to happen every 1 second,
the image path is this:
C:\Users\ Alex\ Desktop\images
image link: https: //imgur.com/a/8lycUlz
Re: script pixel and image check
Feel free to post your revised script. You will need to add your image path. When I checked the bar, I found the following four BGR colors, but not the one that you mentioned.
0xA50082
0xB50190
0xA90D89
0x63074E
How did you determine the color?
You can decide what color you want to target.
You can debug the script by adding lines to determine what is happening at each step. Add a MouseMove to a corner of your search area. Is each search failing, or succeeding? You can add lines to display the ErrorLevels. How did you determine your coordinates?
0xA50082
0xB50190
0xA90D89
0x63074E
How did you determine the color?
You can decide what color you want to target.
You can debug the script by adding lines to determine what is happening at each step. Add a MouseMove to a corner of your search area. Is each search failing, or succeeding? You can add lines to display the ErrorLevels. How did you determine your coordinates?
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
Re: script pixel and image check
I determined both the color and the coordinates using the window spy tool
is that standard that comes directly with AHK
I'm new to programming and I'm still studying, so any help would be appreciated.
I have a little sense of script reading, but I don't know much about creating them
is that standard that comes directly with AHK
I'm new to programming and I'm still studying, so any help would be appreciated.
I have a little sense of script reading, but I don't know much about creating them
Re: script pixel and image check
OK. Are your coordinates relative or absolute?
If you used RGB as the color format, you would need to specify that in the PixelSearch mode.
If you used RGB as the color format, you would need to specify that in the PixelSearch mode.
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
Re: script pixel and image check
I use screen coordinates,
yes, maybe you are not identifying the color because you did not specify the RGB format
yes, maybe you are not identifying the color because you did not specify the RGB format
Re: script pixel and image check
I did not find any B7 values, but you can try adding "RGB" and give it a go.
If you want to use absolute coordinates, you would need to specify that with CoordMode.
If you want to use absolute coordinates, you would need to specify that with CoordMode.
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
Re: script pixel and image check
so I adjusted the script, but I don't know if my code is correct.
can you tell me if i'm doing something wrong?
can you tell me if i'm doing something wrong?
Code: Select all
#SingleInstance, Force
CoordMode, Pixel, Screen ; need this since you are using screen coordinates
PixelSearch,,, 680, 25, 1000, 40, 0xB7008F, RGB, ; Blue, green, red
If !ErrorLevel
Return
ImageSearch,,, 530, 578, 580, 600, *50 C:\Usuários\Alex\Desktop\imagens ; Provide path to image
Send % ErrorLevel ? "" : "{End}"
Re: script pixel and image check
It looks OK. Your next step is to figure out if each search succeeded or failed. You can add some MsgBox lines to tell you that.
-
- Posts: 84
- Joined: 13 Dec 2020, 08:35
Re: script pixel and image check
I noticed that the search is failing because I determined these pixel search coordinates only on a piece of the bar, and even though the bar is full it checks I'll put an image below to explain it better
Re: script pixel and image check
If your color 0x8F00B7 is an RGB color, and you add the "RGB" mode, then you would need to adjust your current script accordingly.
An additional error is that you have specified RGB as the variation instead of the mode. It is possible that the two errors have cancelled themselves and do not matter.
When I test pixel searches, I test them without a variation first, to get the basic script working. You want to demonstrate that you can find a pixel of some kind.
An additional error is that you have specified RGB as the variation instead of the mode. It is possible that the two errors have cancelled themselves and do not matter.
When I test pixel searches, I test them without a variation first, to get the basic script working. You want to demonstrate that you can find a pixel of some kind.
Who is online
Users browsing this forum: No registered users and 122 guests