Jump to content

Clicking when a color passes under the mouse?


Recommended Posts

Well, i want to make it click when the color white passes under the mouse. the mouse will be in a fixed position so moving it does not matter. this is the current code that i have. i searched the help file but i found nothing about how to find if white is under your mouse. thanks for the help if you can help me. im trying to make this as simple as possible since im somewhat new to this.

HotKeySet("{ESC}", "Exit")



$d = 1
While $d = 1

    If ????????????   Then MouseClick ("left")

Wend
Link to comment
Share on other sites

HotKeySet("{ESC}", "Exit")

While 1
   $Pos = MouseGetPos ()
   If PixelGetColor($Pos[0], $Pos[1]) = 16777215  Then MouseClick ("left")
  ; Or
  ;If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
Wend

Edited by Burrup

qq

Link to comment
Share on other sites

well, im trying to make it so it instantly shoots the guys that cross a certain point. it doesnt like to work all the time. this is the link to the game that im trying to make it shoot the people with:

http://www.awfuljunk.com/game/86/bloody_day.php

if someone wants to try and help me out, you can. You also need a delay in the shot because if you repeatedly hit things without missing, you get a points bonus which means higher score obviously. no, im not trying to get the best score or w/e i just want to see if i can do it. also, i think one of the problems is that you have a built in xhair which is a red dot where your cursor should be. there is also a tiny black line around the white guys running around, perhaps that can be of use? so far with it, ive gotten a score of 670. without it(using only myself) i got a score of 3750. i want to make it perfect or try to atleast so that the score can be infinite. each time you kill a guy you get a time bonus.

this is the newest code i have now:

HotKeySet("{NUMPAD8}", "Closing")


While 1
   $Pos = MouseGetPos ()
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
Sleep(50)
WEnd

Func Closing()
Exit
EndFunc

thanks for the help

Ok, i recently tried to make it shoot when it saw a black line, but it just went crazy. it kept shooting at the black lines where the xhair is. hmm...

Edited by BlueForce
Link to comment
Share on other sites

How is this an autoIT script? Is there a autoIT to Flash converter? Please explain.

Steve

well, im trying to make it so it instantly shoots the guys that cross a certain point. it doesnt like to work all the time. this is the link to the game that im trying to make it shoot the people with:

http://www.awfuljunk.com/game/86/bloody_day.php

if someone wants to try and help me out, you can. You also need a delay in the shot because if you repeatedly hit things without missing, you get a points bonus which means higher score obviously. no, im not trying to get the best score or w/e i just want to see if i can do it. also, i think one of the problems is that you have a built in xhair which is a red dot where your cursor should be. there is also a tiny black line around the white guys running around, perhaps that can be of use? so far with it, ive gotten a score of 670. without it(using only myself) i got a score of 3750. i want to make it perfect or try to atleast so that the score can be infinite. each time you kill a guy you get a time bonus.

this is the newest code i have now:

HotKeySet("{NUMPAD8}", "Closing")
While 1
   $Pos = MouseGetPos ()
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
Sleep(50)
WEnd

Func Closing()
Exit
EndFunc

thanks for the help

Ok, i recently tried to make it shoot when it saw a black line, but it just went crazy. it kept shooting at the black lines where the xhair is. hmm...

<{POST_SNAPBACK}>

Basgetti.comSoftware worth donating to ...
Link to comment
Share on other sites

How is this an autoIT script?  Is there a autoIT to Flash converter?  Please explain.

Steve

<{POST_SNAPBACK}>

ok, i put my mouse on the flash thing and leave my mouse alone. but it doesnt shoot all that often for some reason. it doesnt detect the flash or anything. all it does is detects if there is white under the xhair, and if there is then it clicks. i wanted to make a perfect one so it would get a headshot everytime. for it to work, i found that the xhair needs to move around quite fast so the red dot and the black lines arent detected just the white body.

the main objective is to make it so it gets a headshot without shooting extra bullets or ever missing. but that isn't happening. i think i have an idea of how to do it so i guess ill have to try that next. ill update soon as i test my idea.

after playing it a couple more times ive reached a score of over 7000 myself. the pistol is the best because you can use 3 bullets to kill them. which is 3 consecutive hits which means your score go's up very rapidly. although it's hard to 3 shot everyone since they are moving fast.

ok so here are my recent attempts to make it better but sometimes it shoots to fast and causes a miss which isnt good. also, why is there a 6 after the 2 $Pos? is that slowing it down? or what does that signify? i couldnt find what it did in the help thing.

HotKeySet("{NUMPAD8}", "Closing")



Sleep(5000)


While 1
   $Pos = MouseGetPos ()
;lower left
   MouseMove (569, 585, 0)  
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
;lower right
   MouseMove (567, 585, 0)
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
;upper left
   MouseMove (569, 581, 0)
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
;upper right
   MouseMove (567, 581, 0)
   If Hex(PixelGetColor($Pos[0], $Pos[1]), 6) = "FFFFFF"  Then MouseClick ("left")
   WEnd

Func Closing()
Exit
EndFunc
Edited by BlueForce
Link to comment
Share on other sites

Well PixelGetColor() returns the decimal value... White's decimal value is 16777215 and its hex value is 0xFFFFFF. I provided you with 2 options in my first post, to use the standand PixelGetColor() return, or to use it with the Hex() function, which will convert what PixelGetColor() returns in to hexadecimal format ie, in this case white > "FFFFFF".

Try using this whay instead of converting it...

If PixelGetColor($Pos[0], $Pos[1]) = 16777215  Then MouseClick ("left")

Edit: More information...

Look at the Hex() function in the help file. The parametre for how many characters to return in this case is 6.

F F F F F F
1 2 3 4 5 6

It would slow it down a tiny bit i presume.

Edited by Burrup

qq

Link to comment
Share on other sites

Oh fun.!! I got a score of 905...

<{POST_SNAPBACK}>

i got 1385 with this:

HotKeySet( "{ESC}", "myexit" )
HotKeySet( "^1", "shoot" )
HotKeySet( "^2", "pause" )

pause()

func pause()
    While 1
        Sleep(10)
    WEnd
endfunc

func shoot()
While 1
    
$pos = MouseGetpos()
$loc = PixelSearch( $pos[0] - 20, $pos[1] - 20, $pos[0] + 20, $pos[1] + 20, 16777215, 20, 2)

Select
Case @Error <> 1
        MouseClick("left", $loc[0], $loc[1], 2, 0 )
        Sleep(50)
    EndSelect
    Sleep(10)
    WEnd
endfunc

func myexit()
    Exit
endfunc

u may wanna play around with the sleeps a bit tho...

Edit: also with the number of clicks

Edited by datkewlguy
Link to comment
Share on other sites

1755 :)

That score was with it at neck level so it did not do 1 shot kills.

#include <GUIConstants.au3>


HotKeySet( "{ESC}", "myexit" )
HotKeySet( "{pause}", "pause" )
HotKeySet( "{enter}", "show" )
HotKeySet( "{del}", "s" )

Dim $pause = 0, $move = 0, $s[2], $size[2]
$size[0] = 500
$size[1] = 73
$gui = GUICreate( "", $size[0], $size[1], 0, 0, BitOR($WS_POPUP, $WS_SYSMENU), BitOR( $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
GUISetState( @SW_SHOW, $gui)
WinSetTrans( $gui, "", 150)

show()
pause()

While 1

$loc = PixelSearch( $s [0], $s [1], ($s [0] + $size[0]), _
($s [1] + $size[1]), 16777215, 25, 10)
If Not @error Then
    MouseClick( "Left", $loc[0], $loc[1], 1, 0)
EndIf
;~ Sleep(10)
WEnd


Func show()
$move = Not $move
If $move = 0 Then Return
GUISetState( @SW_SHOW, $gui)
While $move = 1
WinMove( $gui, "", MouseGetpos(0) + 1, MouseGetpos(1))
Sleep( 10)
WEnd
GUISetState( @SW_HIDE, $gui)
EndFunc

Func s()
    $s = MouseGetpos()
EndFunc

func pause()
    $pause = Not $pause
    While $pause = 1
        ToolTip( "Paused.", 0, 0)
        Sleep(10)
    WEnd
    ToolTip( "")
endfunc

func myexit()
    Exit
endfunc

Edit:

1835

Edited by UP NORTH
Link to comment
Share on other sites

I just got 1950 with just my bare hands. Shooting them up to 3 times apiece is the trick.

Edit: 2105

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...