Jump to content
Sign in to follow this  
BluBlack

Can't figure out what's wrong with my script >_>

Recommended Posts

BluBlack

OK, I've just started using AutoIt a few days ago, and I decided to try and make a simple script for a game i play ;) . This is the code I'm using:

Sleep(3000)
Global $color = 0xA872B4

While 1=1
    Send('{SHIFTDOWN}')
    $search = PixelSearch(4,30,805,355,$color,5,3)
    If Not @error Then
        Send('{F8}')
        Mouseclick('left',$search[0], $search[1],1,5)
        Sleep(7000)
        EndIf
        If @error Then
        Mouseclick('left',410,585,1,5)
        Sleep(5000)
    EndIf
WEnd

Basically, all I want it to do is to hold shift, detect a certain pixel and click on it, and if it doesn't detect any, it'll click on another different coordinate. And everything seems to be working fine, except that it won't click at all. The pointer moves to the pixel but doesn't click it. Would appreciate it if someone could help me out :D

Share this post


Link to post
Share on other sites
Andreik

OK, I've just started using AutoIt a few days ago, and I decided to try and make a simple script for a game i play ;) . This is the code I'm using:

Sleep(3000)
Global $color = 0xA872B4

While 1=1
    Send('{SHIFTDOWN}')
    $search = PixelSearch(4,30,805,355,$color,5,3)
    If Not @error Then
        Send('{F8}')
        Mouseclick('left',$search[0], $search[1],1,5)
        Sleep(7000)
        EndIf
        If @error Then
        Mouseclick('left',410,585,1,5)
        Sleep(5000)
    EndIf
WEnd

Basically, all I want it to do is to hold shift, detect a certain pixel and click on it, and if it doesn't detect any, it'll click on another different coordinate. And everything seems to be working fine, except that it won't click at all. The pointer moves to the pixel but doesn't click it. Would appreciate it if someone could help me out :D

Try this:

Sleep(3000)
Global $color = 0xA872B4

While 1
    Send('{SHIFTDOWN}')
    $search = PixelSearch(4,30,805,355,$color,5,3)
    If Not @error Then
        Send('{F8}')
        Mouseclick('left',$search[0], $search[1],1,5)
        Sleep(7000)
    Else
        Mouseclick('left',410,585,1,5)
        Sleep(5000)
    EndIf
WEnd

For me work fine.


When the words fail... music speaks

Share this post


Link to post
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
Sign in to follow this  

×