boiler wrote: ↑19 Apr 2021, 14:46
What in your script tells it to stop after it has found it has turned white? I haven’t tested it, so maybe the
MouseClickDrag sufficiently releases the LButton so that the
while loop will stop. If it does have that effect, then it would cause a different issue (the last one mentioned), so there is a problem either way.
Also,
if ErrorLevel will execute the statement that follows it when the color white is
not found, because ErrorLevel of 1 means not found. ErrorLevel is 0 when it finds the color, so
if !ErrorLevel is how you tell it to execute the following line when the specified color is found.
Another potential issue is that you immediately check for the LButton to be pressed after the first part, so you missed your chance if it wasn’t already down when it first hits the
while statement. If you didn’t already have the LButton down when you pressed the RButton, then the
while condition won’t be true. And it might not anyway if the preceding
MouseClickDrag causes the LButton to be effectively released when it gets to the
while statement.
Code: Select all
Xbutton1::Suspend, toggle
$Rbutton::
MouseMove, 1274, 344
MouseClickDrag, left, 0, 0, 0, 500, 20, relative
while GetKeyState("LButton")
{
PixelSearch, x, y, 1183, 1023, 1206, 1029, 0xFFFFFF, , fast RGB
if !ErrorLevel
MouseClickDrag, left, 0, 0, 0, -1000, 2, relative
}
So i've edited it a tiny bit, my thought process is It drags while holding down mouse one, and as soon as the pixel turns white, it pulls up, so that gets me confused with MouseClickDrag. Does that just execute that 500 distance at 20 speed and after it reaches the 500, then it scans? I need it to scan for a change WHILE mouse one is being dragged down and pressed at the same time. I feel like i'm almost there.