AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Creating a transparent window, which contains a pixelSearch?
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 6:24 am    Post subject: Reply with quote

i just copied and pasted your line?



i asumed thats what you meant =s

Code:
 pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, 0xE6EFEF ; BLUE/GREEN/RED order 


and il post my script once again for an overview.

Code:

;============================================================================
; set coordinates for the screen so GUI position, search and clicks will align

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

;-----------the gui hitbox---------------------------------------------------
bDim = 35 ; Change this to desired size.
;bDim = 5 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

;============================================================================
; Leef_me's choice of pixel color
pixel_color= 0xBBCDCD ; search for red ; BLUE/GREEN/RED order

;Cyber's choice of pixel color
;pixel_color= 0x0000FF

;============================================================================
; If you want to test on an image you can enable this
;image = ImgQL.bmp ; <------filename goes here
;gui, add, picture, , %image%

Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow

; RED/GREEN/BLUE order
Gui, Color, C0C0C0
;Gui, Color, FF0000 ; <----- Leef_me's choice of GUI fill color

Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

;============================================================================
; get the location of the box, without relying on the above xpos & ypos
; report actual location of the window, and save for imagesearch

WinGetPos , X, Y, Width, Height, hitBox
msgbox !%Title% x%X% Y%Y% W%Width% H%Height%! `n wanted upper_left-> X%xPos% Y%yPos% `n press OK to start search
;return

;================================================================================
;start the search

settimer, find_pixel,-1 ; wait 0.001 seconds before searching
return

;============================================================================

find_pixel:

b:=A_TickCount ; <--- measure the time the pixelsearch takes

pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, 0xE6EFEF ; BLUE/GREEN/RED order 

c:=A_TickCount ; <--- measure the time the pixelsearch takes
d:=c-b

;============================================================================
; for testing, show a tooltip instead of causing a mouseclick

;tooltip, !!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

; the next line shows 1/1000 second, 0 if found, x and y coordinates
;tooltip, !%d%!!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

;MouseClick [, WhichButton , X, Y, ClickCount, Speed, D|U, R]

MouseClick , left , TL , BR , 1 , 10


settimer, find_pixel , -200 ; wait 0.2 seconds between searches

return

;================================================================================
f3::   ; get the color of the pixel at the mouse cursor location
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

; coodinates are relative to screen based on CoordMode used at top of script

MouseGetPos, xx , yy
PixelGetColor, cc, xx, yy
tooltip %xx% %yy% %cc%
return
 
;----------------------------end statemnts------------------------------------
esc::
^z::ExitApp

_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 6:35 am    Post subject: Reply with quote

also i was wondering leaf_me,
do you have a certain time that you are available online.
was thinking it may be easier if we were both online, so we dont have to wate day for day reply's =)

or msn?
something liek that may make things easier.

i love in aus so im not sure how to work out world wide times but yeah =s

its upto you tho =)
cheerz.
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
OMG
Guest





PostPosted: Mon Nov 30, 2009 7:29 am    Post subject: Reply with quote

Code:
;============================================================================

find_pixel:

pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, 0xE6EFEF ; BLUE/GREEN/RED order

If ErrorLevel = 0    ; if pixel was found
   MouseClick , left , TL , BR , 1 , 10

settimer, find_pixel , -200 ; wait 0.2 seconds between searches

return

;================================================================================
Back to top
Leef_me



Joined: 08 Apr 2009
Posts: 1460
Location: San Diego, California

PostPosted: Mon Nov 30, 2009 9:12 am    Post subject: Reply with quote

See P.M. for meeting times

Cyber, It's pretty frustrating when you type a lot Crying or Very sad but don't read a lot.

ex:
Leef_me wrote:
I suggest that you have the wrong color for green.
Here is a bmp of the color you are searching for.
http://www.autohotkey.net/~Leef_me/BGR_E6EFEF.bmp

Cyber wrote:
is that really the color i selected

Leef_me wrote:
The BMP I posted is indeed the color 0xE6EFEF

To find the proper color, go back to my instructions, and do steps 4 & 5

Leef_me wrote:
Did you follow my instructions on how to get the color.?

Post your line of code for the imagesearch.

Cyber wrote:
i just copied and pasted your line?

i asumed thats what you meant =s

Code:
 pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, 0xE6EFEF ; BLUE/GREEN/RED order 
Back to top
View user's profile Send private message
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 9:37 am    Post subject: Reply with quote

oh im sorry, iv bean reading alot, but i mustnt be understanding =/
thankyou for the help tho, sorry to frustrate you.


so once again. what "exactly" must i do to obtain the right color.
see im not sure what exactly is wrong with my script that it is always clicking any color.
if i chose that color on bmp. shouldnt it be only clicking that color?
even if it was the wrong color?

sorry for being slow =s

ill look through the last cople of posts and see what iv missed. thanks leaf_me
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Leef_me



Joined: 08 Apr 2009
Posts: 1460
Location: San Diego, California

PostPosted: Mon Nov 30, 2009 9:38 am    Post subject: Reply with quote

Cyber,
Here is my original post with the script slightly modified per OMG's suggestion.

Please, take the image you captured, and this new script and start with step 4 below.

Please follow all the steps!!



4. Test against the captured image BMP, edit the script to correct the lines.
Code:
image = 4red_pixel.bmp ; <------filename goes here
gui, add, picture, , %image%

Save and run it. You should get the image that you saved.
Don't press OK. Instead, move your cursor over the image and see the color values by pressing F3.

5. Note the color you want

6. Edit the script line with your choice of 'pixel_color'
6a. edit line 19 of the script, not line 58 with the proper color info
6b. Save and run the script

7. determine if the script works to find the color
7a. !600!0!480!452! <--- the 2nd number =0 is good
7b. !!1!!! <--- the 2nd number =1 is BAD
7c. if the script works to find the pixel on the captured image disable line 24 ";gui, add, picture, , %image% "
7d. retest the script with your game

8. if the script works to find the pixel on the game, edit the script to comment out the tooltip and enable the mouseclick.

Code:
;============================
================================================
; set coordinates for the screen so GUI position, search and clicks will align

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

;-----------the gui hitbox---------------------------------------------------
bDim = 35 ; Change this to desired size.
;bDim = 5 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

;============================================================================
; Leef_me's choice of pixel color
pixel_color= 0x0000FF ; search for red ; BLUE/GREEN/RED order

;Cyber's choice of pixel color
;pixel_color= 0x0000FF ; <----------------- Please edit this line for Cyber's choice

;============================================================================
; If you want to test on an image you can enable this
image = 4red_pixel.bmp ; <------filename goes here
;gui, add, picture, , %image%

Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow

; RED/GREEN/BLUE order
Gui, Color, C0C0C0
;Gui, Color, ff0000 ; <----- Leef_me's choice of GUI fill color

Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

;============================================================================
; get the location of the box, without relying on the above xpos & ypos
; report actual location of the window, and save for imagesearch

WinGetPos , X, Y, Width, Height, hitBox
msgbox !%Title% x%X% Y%Y% W%Width% H%Height%! `n wanted upper_left-> X%xPos% Y%yPos% `n press OK to start search
;return

;================================================================================
;start the search

settimer, find_pixel,-1 ; wait 0.001 seconds before searching
return

;============================================================================

find_pixel:

b:=A_TickCount ; <--- measure the time the pixelsearch takes

pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, pixel_color ; BLUE/GREEN/RED order

c:=A_TickCount ; <--- measure the time the pixelsearch takes
d:=c-b

;============================================================================
; for testing, show a tooltip instead of causing a mouseclick

;tooltip, !!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

; the next line shows 1/1000 second, 0 if found, x and y coordinates
tooltip, !%d%!!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

;MouseClick [, WhichButton , X, Y, ClickCount, Speed, D|U, R]

;If ErrorLevel = 0    ; if pixel was found
   ;MouseClick , left , TL , BR , 1 , 10

settimer, find_pixel , -200 ; wait 0.2 seconds between searches

return

;================================================================================
f3::   ; get the color of the pixel at the mouse cursor location
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

; coodinates are relative to screen based on CoordMode used at top of script

MouseGetPos, xx , yy
PixelGetColor, cc, xx, yy
tooltip %xx% %yy% %cc%
return
 
;----------------------------end statemnts------------------------------------
esc::
^z::ExitApp

Back to top
View user's profile Send private message
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 9:41 am    Post subject: Reply with quote

i went back to questions 3-4, i didn tunderstand what you ment, but i read over it and here is the color i got when i pressed f3 over the image.

1199 483 0x31ffff

ok, is that exaclty what i use as the pixel searcgh, are just the 0x31ffff.
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 9:44 am    Post subject: Reply with quote

juat reading through your last post. il let you know when iv finsihed the steps. thank
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Leef_me



Joined: 08 Apr 2009
Posts: 1460
Location: San Diego, California

PostPosted: Mon Nov 30, 2009 9:45 am    Post subject: Reply with quote

Just the 0x number. wow were online together !
Back to top
View user's profile Send private message
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 9:55 am    Post subject: Reply with quote

i know how wierd hey!!! hahaha

omg my script is actualy working 0,0
thankyou so much.

ok im going to tset it on this game for 30 seconds and see how it goes.

il post back when im finsihed.

heres my script curently

Code:

;============================================================================
; set coordinates for the screen so GUI position, search and clicks will align

CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

;-----------the gui hitbox---------------------------------------------------
bDim = 35 ; Change this to desired size.
;bDim = 5 ; Change this to desired size.
xPos = % (A_ScreenWidth/2) - bDim
yPos = % (A_ScreenHeight/2) - bDim

;============================================================================
; Leef_me's choice of pixel color
;pixel_color= 0xBBCDCD ; search for red ; BLUE/GREEN/RED order

;Cyber's choice of pixel color
pixel_color= 0xCECOBD


;============================================================================
; If you want to test on an image you can enable this
image = ImgQL.bmp ; <------filename goes here
gui, add, picture, , %image%

Gui, +alwaysontop
Gui, -Caption Border AlwaysOnTop ToolWindow

; RED/GREEN/BLUE order
Gui, Color, C0C0C0
;Gui, Color, FF0000 ; <----- Leef_me's choice of GUI fill color

Gui, Show, NA W%bDim% H%bDim% X%xPos% Y%yPos%, hitBox

WinWait, hitBox
WinSet, TransColor, C0C0C0 255, hitBox

;============================================================================
; get the location of the box, without relying on the above xpos & ypos
; report actual location of the window, and save for imagesearch

WinGetPos , X, Y, Width, Height, hitBox
msgbox !%Title% x%X% Y%Y% W%Width% H%Height%! `n wanted upper_left-> X%xPos% Y%yPos% `n press OK to start search
;return

;================================================================================
;start the search

settimer, find_pixel,-1 ; wait 0.001 seconds before searching
return

;============================================================================

find_pixel:

b:=A_TickCount ; <--- measure the time the pixelsearch takes

pixelSearch  , TL , BR , X, Y, X+Width, Y+Height, 0xCECOBD  ; BLUE/GREEN/RED order 

c:=A_TickCount ; <--- measure the time the pixelsearch takes
d:=c-b

;============================================================================
; for testing, show a tooltip instead of causing a mouseclick

;tooltip, !!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

; the next line shows 1/1000 second, 0 if found, x and y coordinates
;tooltip, !%d%!!%errorlevel%!%TL%!%BR%!, xpos+50, ypos

;MouseClick [, WhichButton , X, Y, ClickCount, Speed, D|U, R]

MouseClick , left , TL , BR , 1 , 10


settimer, find_pixel , -200 ; wait 0.2 seconds between searches

return

;================================================================================
f3::   ; get the color of the pixel at the mouse cursor location
CoordMode, Mouse, Screen
CoordMode, Pixel, Screen
CoordMode, Tooltip, Screen

; coodinates are relative to screen based on CoordMode used at top of script

MouseGetPos, xx , yy
PixelGetColor, cc, xx, yy
tooltip %xx% %yy% %cc%
return
 
;----------------------------end statemnts------------------------------------
esc::
^z::ExitApp

_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 9:57 am    Post subject: Reply with quote

once i agaiun i didnt read everything.. il add omg's part of the script.
test on the game then post back. cheers
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Leef_me



Joined: 08 Apr 2009
Posts: 1460
Location: San Diego, California

PostPosted: Mon Nov 30, 2009 9:57 am    Post subject: Reply with quote

btw, 0x31ffff is a form of yellow, sorta mustard
Back to top
View user's profile Send private message
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 10:06 am    Post subject: Reply with quote

yeah thats the color from the screen shot,

report:

works fine, anything that exaclt color, it wil move the mouse to that cordinate even! i wasnt expecting that =D
2 problems tho
1- playing the game it wont click the yelow ish color.. it only works when im not playing the game =/
2- the hitbox isnt ontop if the game window.


im thinking the reson for it not left clicking the yelowish color si becoms the game has shadowning and whatnot and the characters vary from a bright yelow to a mustard green.
_________________
---{+.-}---
Back to top
View user's profile Send private message MSN Messenger
Cyber



Joined: 11 Mar 2009
Posts: 86
Location: Nsw/Syd/Kiama

PostPosted: Mon Nov 30, 2009 10:08 am    Post subject: Reply with quote

screeny =D

[b]screenshot of the color b]
_________________
---{+.-}---


Last edited by Cyber on Mon Nov 30, 2009 10:08 am; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
Leef_me



Joined: 08 Apr 2009
Posts: 1460
Location: San Diego, California

PostPosted: Mon Nov 30, 2009 10:08 am    Post subject: Reply with quote

0xCEC0BD, is a form of light blue, (and you mis-typed an Oh instead of zero)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group