Sign in to follow this  
Followers 0
84cr250

detecting motion then clicking it

9 posts in this topic

im wondering if there is a way using auto it to watch a window and detect a large amount of motion then click it. i know about image search and pixel cheaksums and about "Using a color change as an event" but i cant seem to get that to work for what i need.

im just trying to automate a game like wack-a-mole so i need it to watch for them to pop up so it can click them but the only problem im having is that there is blinking lights and other meters moving on the side. so there is always a bit of movement.

is there a way to watch for movement but have a tolerance set up so it doesnt react to just any movement it reacts to a large amount.

thanks for the help

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

is there a unique color on the objects in their 'up' state? you could constantly search the areas necessary for that color and if it appears click on it.

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

not really thats i could find, any colors on the moles are also al over the window its open in and the bord that the things come out of. i tryed with pixels and colors for about a week now.

is there away to look for a group of let say 100 pixels as a hole and detect that moving, not just a small group of pixels moving??

i have been useing this to test if a color only shows up in one spot or a few spots and i cant find a color that is unique to the "up" stage of them

Sleep(3000)


Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
    Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; ************************************************* ;
; Change your settings here                         ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv ;
$ExitKey = "{ESC}"
$Color = 0XBDBABD
$Left = 150
$Top = 75
$Right = 500
$Bottom = 435
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ;
; Change your settings here                         ;
; ************************************************* ;

HotKeySet($ExitKey, '_Exit')
    
While 1
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)
    If Not @error Then
        Sleep(500)
        MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 1, 0)
        Sleep(2000)
        ;MouseClickDrag("left", $SearchResult[0], $SearchResult[1], 200, 200)
    EndIf
WEnd

also this to see x and y locations with a image of the color im looking at as well as the value of it

#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}","Close")
HotKeySet("{F9}","Copy")

Opt('PixelCoordMode', 2)
Opt('MouseCoordMode', 2)
Global $Mpos, $PixColor

$mousebox = GUICreate("",150,150,0,0,BitOR($WS_CAPTION, $WS_POPUP),$WS_EX_TOPMOST)
GUICtrlCreateLabel("X pos:",10,10,80,25)
GUICtrlCreateLabel("Y pos:",10,40,80,25)
GUICtrlCreateLabel("Color:",10,70,80,25)
$mousex = GUICtrlCreateLabel("",60,10,80,25)
$mousey = GUICtrlCreateLabel("",60,40,80,25)
$mousecolor = GUICtrlCreateLabel("",60,70,80,25)
$mousecolorex = GUICtrlCreateGraphic(10,100,130,30)
GUISetState()

While GUIGetMsg()<>$GUI_EVENT_CLOSE
$Mpos = MouseGetPos()
$PixColor = PixelGetColor($Mpos[0]-3, $Mpos[1]-3)
GUICtrlSetData($mousex,$Mpos[0]-3)
GUICtrlSetData($mousey,$Mpos[1]-3)
GUICtrlSetData($mousecolor,Hex($PixColor, 6))
GUICtrlSetBkColor($mousecolorex,"0x"&Hex($PixColor, 6))
sleep(100)
WEnd

Func Close()
    Exit
EndFunc

Func Copy()
    ClipPut($Mpos[0]-3&", "&$Mpos[1]-3&", 0x"&Hex($PixColor, 6))
EndFunc
Edited by 84cr250

Share this post


Link to post
Share on other sites

Please see the announcement concerning Game bots. If you do not know where to find it, you may click on this friendly link.

http://www.autoitscript.com/forum/index.php?showannouncement=12&f=2

lol oh ok thanks for the info lol ill repost it with out that line in it if that helps you sleep at night

ok sorry its not a game

im trying to look for movement then click it on my desktop. sorry i made a mastake in the last post and said it was a game its not. im sorry i didnt mean to i must have click the wrong keys. im bad for typos

THIS IS WHAT I MENT IT TO SAY.

im wondering if there is a way using auto it to watch a window and detect a large amount of motion then click it. i know about image search and pixel cheaksums and about "Using a color change as an event" but i cant seem to get that to work for what i need.

so i need it to watch for things to pop up so it can click them but the only problem that there are other things moving on the screen. so there is always a bit of movement on my screen that i dont need to detect

is there a way to watch for movement but have a tolerance set up so it doesnt react to just any movement it reacts to a large amount.

thanks for the help

Share this post


Link to post
Share on other sites

so i take it you are not taking suggestions for the next contest

http://www.autoitscript.com/forum/index.php?showtopic=118413&hl=contest&st=0

my bot for your bubble breaker has like a 2000 high score, but still sux.


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

so this is what MPH said:

The bot rule does not apply here for you are only working with a single player game and there is no TOS for this game.

so im guessing this little flash game i have that is SINGLEPLAYER ONLY is ok to ask about then

and my buddy is the one who made it for a school project and he said its ok to bot the game and to hack it......

so the tos says i can if i want to

Share this post


Link to post
Share on other sites

Thread locked.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0