Jump to content

Auto Duck Hunt


Travmanx
 Share

Recommended Posts

Something little I made, I'm still new at this. If anyone has any suggestions or comments please say. :D

;========================================================
; Duck Hunter Auto Shooter
; Script Written by Travmanx
; Play at http://www.cyberiapc.com/flashgames/duckhunt.htm
; Once loaded, click script and sit back and watch
; 95% Perfect shot rate
;6/18/06 - 12 Minutes 32 Seconds
;========================================================
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Opt("PixelCoordMode",0)
HotKeySet("{ESC}","Done")
    WinWait("Shockwave Flash Games: Duck Hunt - Mozilla Firefox","")
    If Not WinActive("Shockwave Flash Games: Duck Hunt - Mozilla Firefox","") Then WinActivate("Shockwave Flash Games: Duck Hunt - Mozilla Firefox","")
    WinWaitActive("Shockwave Flash Games: Duck Hunt - Mozilla Firefox","")
    MouseWheel("down", 5)
    MouseMove(500,540)
    MouseDown("left")
    MouseUp("left")
    Sleep(1000)
    While 1
    $duck = PixelSearch(0,0,1024,768,0xFF795A,0)
    if IsArray($duck) Then MouseMove($duck[0],$duck[1],0)
                
            MouseClick("left")
    
        Wend 

    
Func Done() 
    Exit
    EndFunc
Link to comment
Share on other sites

I didn't hit a single duck...

Oh wait, i'm using Internet Explorer, not mozilla.. lol ^^

Here's a few tips that might help you:

Use Opt("WinTitleMatchMode",2)

You can now use

WinWaitActive("Duck Hunt","")
in stead of

WinWaitActive("Shockwave Flash Games: Duck Hunt - Mozilla Firefox","")

Also, i suggest, using a smaller area for the pixelsearch..

Your entire screen, (@DesktopWidth & @DesktopHeight Not 1024,768), is generally too much.

To find out what area to use: ControlGetPos()

I found the classname with the AutoIt window tool. (MacromediaFlashPlayerActiveX1)

Always use relative coordinates in stead of fixed coordinates. Because i have a larger resolution than 1024x768, MouseMove(500,540) mis-clicked. You should also check if an action has gone right or wrong.

$a = Pixelsearch(something)

If IsArray($a)

can be replaced by a

$a = Pixelsearch(something)

if not @error

Although i'm not sure which is the better method, there was a discussion about this in support, look it up..

[edit] Also look at this: http://www.autoitscript.com/forum/index.php?showtopic=21048

That's a good example of what you wanted to do.

Edited by Manadar
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...