Hey, hopefully, someone can figure out my issue so I can continue my project. Basically, I have a simple PixelSearch looking for a specific color in a game, this works well until I put it into my GUI as a button. I have taken the lines of code of the PixelSearch out of the GUI and tested them on their own and work well but as I said before the PixelSearch cannot find the color once put back into the GUI. Extremely frustrating as I press the button in the GUI and it comes back with no match but test the code by itself and works fine.... Thank you for any help!
--------------------------------------------------
GUI
--------------------------------------------------
Gui, +AlwaysOnTop
Gui, Show, x1650 w200 h400, LMBv1
Gui, Add, Picture, w180 h90, C:\Users\CMZel\Pictures\LMlogo.png
Gui, Color, 818181
Gui, Font, cBlack
Gui, Add, Button, x10 y110 w80 h30 gGather_ore, Gather Ore
Gui, Add, Button, x10 y160 w80 h30,
Gui, Add, Button, x10 y210 w80 h30,
Gui, Add, Button, x10 y260 w80 h30,
Gui, Add, Button, x10 y310 w80 h30,
Gui, Add, Button, x110 y110 w80 h30,
Gui, Add, Button, x110 y160 w80 h30,
Gui, Add, Button, x110 y210 w80 h30,
Gui, Add, Button, x110 y260 w80 h30,
Gui, Add, Button, x110 y310 w80 h30,
return
Gather_Ore:
{
PixelSearch, FoundA, FoundB, 0, 0, A_ScreenWidth, A_ScreenHeight, 0xE6F72D, 2, Fast
if ErrorLevel = 1
msgbox Error!
if ErrorLevel = 0
Mousemove, %FoundA%, %FoundB%
}
--------------------------------------------------
Pixel Search by itself
--------------------------------------------------
PixelSearch, FoundA, FoundB, 0, 0, A_ScreenWidth, A_ScreenHeight, 0xE6F72D, 2, Fast
if ErrorLevel = 1
msgbox Error!
if ErrorLevel = 0
Mousemove, %FoundA%, %FoundB%
PixelSearch being weird?
Re: PixelSearch being weird?
CoordMode, Pixel, Screen?
Re: PixelSearch being weird?
Oops, my mistake for not adding this but still does not fix the issue. Even if I change to color in which the PixelSearch is trying to find they either find two different ones or the GUI button will toss an error.
Re: PixelSearch being weird?
I am only a few days into AHK but the main issue is that I don't understand why the GUI and code by itself are providing different results.
Re: PixelSearch being weird?
messed up search space coordinates, messed up search color(i hope u realize ure using a BGR color), messed up coordmode(ull probably also need to enable , Mouse, Screen too), game being run in native-fullscreen. theres a multitude of reasons why it wouldnt work.
if ure not using Coordmode, Screen, red area is what ull be searching once u press that button:
if ure not using Coordmode, Screen, red area is what ull be searching once u press that button:
Spoiler
post a screen cap of how ure doing the search and the exact code ure using