waitpixelcolor how to use multiple at same time??

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
idiot
Macro Veteran
Posts: 152
Joined: Thu Mar 01, 2007 9:21 am

waitpixelcolor how to use multiple at same time??

Post by idiot » Mon Jul 14, 2008 9:30 pm

i'm trying to get it to go to sub depending on what color it finds at each spot now its same color for most x,y basically im trying something like this
but not quite working right havent used this in awhile need a bit of help
i know i can do this with getpixel color but im trying to make more manageable

Code: Select all

SetFocus>Endless Online
label>start
let>color=1638350
let>color2=44345
waitPixelColor>color2,360,160,0
if>wpc_result=true
goto>start
if>wpc_result=false
goto>eat
endif
waitPixelColor>color,482,288,0
if>wpc_result=true
goto>leftmelee
else>
goto>start
endif
waitPixelColor>color,480,318,0
if>wpc_result=true
goto>downmelee
else>
goto>start
endif
waitPixelColor>color,540,318,0
if>wpc_result=true
goto>leftmelee
else>
goto>start
endif
waitPixelColor>color,544,288,0
if>wpc_result=true
goto>upmelee
else>
goto>start
endif
label>leftmelee
Let>VK_b=100
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_b,0,ExtendedKey,0
wait>.1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_b,0,FLAGS,0
Let>VK_a=17
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
goto>start
else>
goto>start
endif
label>downmelee
Let>VK_a=98
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>.1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
Let>VK_a=17
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
goto>start
else>
goto>start
endif
label>rightmelee
Let>VK_a=102
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>.1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
Let>VK_a=17
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
goto>start
else>
goto>start
endif
label>upmelee
Let>VK_a=104
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>.1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
Let>VK_a=17
Let>ExtendedKey=1
Let>KeyUp=2
LibFunc>user32.dll,keybd_event,r,VK_a,0,ExtendedKey,0
wait>1
Let>FLAGS={%ExtendedKey% OR %KeyUp%}
LibFunc>user32.dll,keybd_event,r,VK_a,0,FLAGS,0
goto>start
else>
goto>start
endif
label>eat
MouseMove>371,509
LDblClick
wait>1
goto>start
else>
goto>start
[/code]
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!

Snickers
Macro Veteran
Posts: 151
Joined: Thu Dec 09, 2004 3:01 pm
Location: Somewhere in TX

Post by Snickers » Thu Jul 17, 2008 8:56 pm

i'm trying to get it to go to sub depending on what color it finds at each spot now its same color for most x,y

Waitcolorpixel> actually waits for a given amount of time. if the color at that pixel does change to the color then the result = true otherwise the result = false

let>color1=1638350
let>color2=44345
GetPixelColor>X1,Y1,c1
If>c1=color1
do something
endif

GetPixelColor>X2,Y2,c2
If>c2=color2
do something
endif

I like to use a more complex expression

GetPixelColor>X1,Y1,c1
GetPixelColor>X2,Y2,c2

If>{(%c1%=%color1%) and ((%c2%=%color2%)}
goSub>subColor1
endif

If>{(%c1%%color1%) and ((%c2%=%color2%)}
goSub>whatever
endif


you can use and or expressions to come up with your own variations

I would recommend cleaning your code up with subroutines

SRT>subColor1
do whatever
end>subColor1

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts