Jump to content

very simple script and dumb quescon for beginer


Recommended Posts

I'm learning autoit programing language. my goal is to create mini program which can operate like autoclicker. I know that internet is full of these type of programs but I want to learn foundations of this programing language.

My task is to click mouse pointer on specified area and then monitor pixels (left,top,right,bottom) from moving picture (tracking white color) when color disapear, click on specified area on window and then click again on another area.

this is code I've made. when I trying to start script I'm geting an error. I thing is because "then" have no to be there or I need "Ifend" or something at the end.

but last problem which I have no idea how to seolve. I need that this script could work for infinite period of time till I'll terminate program.

P.S. In the future (tomorow) I'll try to create hotkeys which I could on and off the program.

PixelSearch (240, 370, 1000, 450, 0xFFFFFF )
If @error Then 
    MouseClick ( "left", 593, 630, 1 )
    Sleep ( 3000 )
    MouseClick ( "left", 655, 491, 1 )
    Sleep ( 500 )
    MouseClick ( "left", 593, 630, 1 )
Link to comment
Share on other sites

Yep, you need an EndIf.

Once you get your Hotkey set, you can put you click code into a loop

While 1

your click code

Wend

While 1 means "While True" and since there is nothing to change that, it will 'while' forever.

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

I added Hot keys. there is only 2 keys in program. one ir launching another is closing. but I dont know. why when white color disapear nothing hapens... when I launching script on picture winouth white color then mouse pointer jups at programed coordinates, but when picture have white color and passing some time disapearing then script do nothing. what I do wrong ?

long things in short. pres "'" -> searching for white pixels (.gif "moving" picture) -> white pixels disapear -> start to click on coordinates. -> star all over again till user pres "\"

HotKeySet ( "'", "start" )  ;program start
HotKeySet ( "\", "stop" )   ;program stop

$start = PixelSearch (240, 370, 1000, 450, 0xFFFFFF, 0, 1 ) ;program search for white color
If @error Then                                     ;when color disapear program start to clicking
    MouseClick ( "left", 593, 630, 1 )             ;first click
    Sleep ( 3000 ) 
    MouseClick ( "left", 655, 491, 1 )             ;second click
    Sleep ( 500 )
    MouseClick ( "left", 593, 630, 1 )             ;last click
EndIf
Link to comment
Share on other sites

this is little graphical explanation.

Posted Image

after float stops to swing it dive into "water" and white color disapear. acording to my plan when no white pixels left script must imediately click on desired coordinates and then delay and finish clicking. after this procedure program must start all over again till user terminates it with hotkey "\"

Link to comment
Share on other sites

Sry mate but this is not bot program. This is my research to learn basics of programing. And i'm very glad that I did it !!! yay (chuckle)

HotKeySet("{F4}", "start")
HotKeySet("{F6}", "stop")
ToolTip("Pažvejokim ! F4 = Pradėti   F6 = Baigti ")

Global $Pradinis = 0

While 1
    If $Pradinis = 1 Then
        MouseClick("left", 655, 491, 1)
        $Plude = PixelSearch(240, 370, 1000, 450, 0xFFFFFF)
        If @error Then
            MouseClick("left", 593, 630, 1)
            Sleep(3000)
            MouseClick("left", 655, 491, 1)
            Sleep(500)
        EndIf
    EndIf
WEnd

Func start()
    $Pradinis = 1
EndFunc   ;==>start

Func stop()
    MsgBox(0, "#", "Žvejyba baigėsi !")
    Exit
EndFunc   ;==>stop

Next step will be to create custom GUI (background with some picture and icons etc).

Maybe someone have some advices to tel how to improve this script ?

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...