AutoHotkey Community

It is currently May 27th, 2012, 12:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: November 30th, 2009, 6:24 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 6:35 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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.

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 7:29 am 
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

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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:12 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6069
Location: San Diego, California
See P.M. for meeting times

Cyber, It's pretty frustrating when you type a lot :cry: 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 


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:37 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:38 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6069
Location: San Diego, California
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



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:41 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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.

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:44 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
juat reading through your last post. il let you know when iv finsihed the steps. thank

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:45 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6069
Location: San Diego, California
Just the 0x number. wow were online together !


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:55 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:57 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
once i agaiun i didnt read everything.. il add omg's part of the script.
test on the game then post back. cheers

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:57 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6069
Location: San Diego, California
btw, 0x31ffff is a form of yellow, sorta mustard


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 10:06 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
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.

_________________
---{+.-}---


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 10:08 am 
Offline

Joined: March 11th, 2009, 12:00 am
Posts: 86
Location: Nsw/Syd/Kiama
screeny =D

[b]screenshot of the color b]

_________________
---{+.-}---


Last edited by Cyber on November 30th, 2009, 10:08 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 10:08 am 
Online

Joined: April 8th, 2009, 7:49 pm
Posts: 6069
Location: San Diego, California
0xCEC0BD, is a form of light blue, (and you mis-typed an Oh instead of zero)


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Leef_me, Pulover, rjgatito, XstatyK, Yahoo [Bot] and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group