Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

please help me finish the script and please explain how it works


  • Please log in to reply
3 replies to this topic
17kimv old
  • Members
  • 151 posts
  • Last active: Sep 08 2019 04:24 AM
  • Joined: 01 Feb 2015

So my idea is that by pressing f1 it remembers the colors in 4 plases and check every 300 milisec and if any of them changes then click ealse loop again.

 

here is what I got so far:

f1:: ;to remember what colors are
PixelGetColor, colortl, 911, 492 ;top left color
PixelGetColor, colortr, 103, 424 ;top right Color
PixelGetColor, colorbl, -92, 563 ;bottom left color
PixelGetColor, colorbr, 207, 588 ; bottom right color

f2:: ; to start looping
loop:
	sleep 300
PixelGetColor, 2colortl, 911, 492 
PixelGetColor, 2colortr, 103, 424
PixelGetColor, 2colorbl, -92, 563
PixelGetColor, 2colorbr, 207, 588   ;check what colors are there right now and if they are the same click ealse loop
if %colortl% = %2colortl%
	send, {LButton}

ealse 

reloop ;sorry I don't know how to make it loop again


briter
  • Members
  • 148 posts
  • Last active: Jan 31 2018 05:41 PM
  • Joined: 13 Nov 2014

This shoud do it...

 

f1:: ;to remember what colors are
PixelGetColor, colortl, 911, 492 ;top left color
PixelGetColor, colortr, 103, 424 ;top right Color
PixelGetColor, colorbl, -92, 563 ;bottom left color
PixelGetColor, colorbr, 207, 588 ; bottom right color
return
f2
:: ; to start looping
loop

{
 sleep 300
PixelGetColor, 2colortl, 911, 492
PixelGetColor, 2colortr, 103, 424
PixelGetColor, 2colorbl, -92, 563
PixelGetColor, 2colorbr, 207, 588 ;check what colors are there right now and if they are the same click ealse loop
if colortl = 2colortl AND colortr=2colortr AND ... AND...

 {
    send, {LButton}

     break

 }

}



17kimv old
  • Members
  • 151 posts
  • Last active: Sep 08 2019 04:24 AM
  • Joined: 01 Feb 2015

like this?

f1:: ;to remember what colors are
PixelGetColor, colortl, 959, 539 ;top left color
PixelGetColor, colortr, 961, 539 ;top right Color
PixelGetColor, colorbl, 959, 541 ;bottom left color
PixelGetColor, colorbr, 961, 541 ; bottom right color
return
f2:: ; to start looping
loop
{
	sleep 300
	PixelGetColor, 2colortl, 959, 539 
	PixelGetColor, 2colortr, 961, 539
	PixelGetColor, 2colorbl, 959, 541
	PixelGetColor, 2colorbr, 961, 541 ;check what colors are there right now and if they are the same click ealse loop
	if colortl = 2colortl
	{
		send, {LButton}
		break
	}
	
	if colortr = 2colortr
	{
		send, {LButton}
		break
	}
	
	if colorbl = 2colorbl
	{
		send, {LButton}
		break
	}
	
	if colorbr = 2colorbr
	{
		send, {LButton}
		break
	}
	
}



noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

If any of the 4 colors activates the click ,you can simplify by using the sum of the colors (colors are just numbers).If the sum is the same loop else click.

 

By naming positions with an index you can also simplify the loop using the build in "A_Index".

 

Here is an example ,be aware how the pixel coordinates are referenced to screen or to the active window!

pos1x:=552 ,pos1y:=417 ,pos2x:=585 ,pos2y:=417 ,pos3x:=555 ,pos3y:=471 ,pos4x:=606, pos4y:=468

;remove these 2 lines for active window referenced coordinates
coordmode mouse  ;set to screen referenced mouse coordinates
coordmode pixel  ;set to screen referenced pixel coordinates

esc::exitapp

F1::
ref:=0
loop 4
{
PixelGetColor,color,pos%A_Index%x,pos%A_Index%y
ref +=color  ;sum the 4 values
}
msgbox,,,%ref%,2
return


F2::
if (ref="")  ;check if there is a ref value
    {
    msgbox no reference value  
    return
    }
color_check:
sum:=0

loop 4
{
PixelGetColor,color,pos%A_Index%x,pos%A_Index%y
sum +=color
}

if (ref =sum)
    send, {RButton}
    
else
    {
    sleep 300
    goto,color_check
    }
return







winXP  and ahk unicode