Sign in to follow this  
Followers 0
ciraco

Simple Click Bot Help

8 posts in this topic

Hello, I am new to autoit and scripting in autoit.

To start I created a simple browser based click bot, and I would like to extend it further.

What I would like to do:

- Add a pause and terminate hotkeys (that actually work).

- Loop the "14 kill attacks" 10 times before repeating the entire script.

If anyone could give me some tips or show me how to do this, it would be appreciated. Keep in mind I am new to this, so try not to get to technical.

The following is my code:

Opt("MouseClickDelay", 10); add this to very beggining of script, change 10 to whatever $shortsleep is and subtract this from $midsleep.

While 1
Sleep(2000); script start delay
; healing
MouseClick("left", 415,  104, 2); view city
Sleep(1000)
MouseClick("left", 434,  351, 2); tavern
Sleep(1000)
MouseClick("left", 415,  191, 2); rest
Sleep(1500)
; select monster levels
MouseClick("left", 71,  410, 2); battle
Sleep(1000)
MouseClick("left", 696,  201, 2); monster
Sleep(1000)
MouseClick("left", 640,  156, 1); dropdown
Sleep(1000)
Send("{DOWN DOWN}")
Sleep(10)
Send("{Enter}")
Sleep(100)
MouseClick("left", 510,  180, 2); hunt
Sleep(1500)
; atack monsters (1-3)
MouseClick("left", 422,  191, 2); attack (one)
Sleep(1000)
MouseClick("left", 422,  224, 2); attack (two)
Sleep(1000)
MouseClick("left", 422,  255, 2); attack (three)
Sleep(1500)
; kill (14 atacks)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(3500)
WEnd

Share this post


Link to post
Share on other sites



I think this might do it, not certain though

Do
Func Bot()
While 1
Sleep(2000); script start delay
; healing
MouseClick("left", 415,  104, 2); view city
Sleep(1000)
MouseClick("left", 434,  351, 2); tavern
Sleep(1000)
MouseClick("left", 415,  191, 2); rest
Sleep(1500)
; select monster levels
MouseClick("left", 71,  410, 2); battle
Sleep(1000)
MouseClick("left", 696,  201, 2); monster
Sleep(1000)
MouseClick("left", 640,  156, 1); dropdown
Sleep(1000)
Send("{DOWN DOWN}")
Sleep(10)
Send("{Enter}")
Sleep(100)
MouseClick("left", 510,  180, 2); hunt
Sleep(1500)
; atack monsters (1-3)
MouseClick("left", 422,  191, 2); attack (one)
Sleep(1000)
MouseClick("left", 422,  224, 2); attack (two)
Sleep(1000)
MouseClick("left", 422,  255, 2); attack (three)
Sleep(1500)
; kill (14 atacks)
For $Attacks = 1 To 14
MouseClick("left", 594,  175, 2)
Sleep(1000)
Next
EndFunc
Sleep(3500)
WEnd
EndFunc
Until True = False

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

well basicly what i am trying to do is repeat the bolded section of code 10 times within the while 1 for example, the script starts, ite goes through until the attack 14 times part, then it repeats the 14 attacks 10 times before continuing.

Opt("MouseClickDelay", 10); add this to very beggining of script, change 10 to whatever $shortsleep is and subtract this from $midsleep.

While 1

Sleep(2000); script start delay

; healing

MouseClick("left", 415, 104, 2); view city

Sleep(1000)

MouseClick("left", 434, 351, 2); tavern

Sleep(1000)

MouseClick("left", 415, 191, 2); rest

Sleep(1500)

; select monster levels

MouseClick("left", 71, 410, 2); battle

Sleep(1000)

MouseClick("left", 696, 201, 2); monster

Sleep(1000)

MouseClick("left", 640, 156, 1); dropdown

Sleep(1000)

Send("{DOWN DOWN}")

Sleep(10)

Send("{Enter}")

Sleep(100)

MouseClick("left", 510, 180, 2); hunt

Sleep(1500)

; atack monsters (1-3)

MouseClick("left", 422, 191, 2); attack (one)

Sleep(1000)

MouseClick("left", 422, 224, 2); attack (two)

Sleep(1000)

MouseClick("left", 422, 255, 2); attack (three)

Sleep(1500)

; kill (14 atacks)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(1000)

MouseClick("left", 594, 175, 2)

Sleep(3500)

WEnd

Edited by ciraco

Share this post


Link to post
Share on other sites

ok, first. to repeat the attack 14 times, it is easier to put it in a FOR/NEXT statement.

[b]; kill (14 atacks)
For $Attack = 1 To 13
MouseClick("left", 594,  175, 2)
Sleep(1000)
Next
MouseClick("left", 594,  175, 2)
Sleep(3500)[/b]

This will tell it to repeat the attack 13 times and then one last time with the extra 3.5 second delay. To repeat that whole thing 10 times you simply put the whole thing into another for statement like so:

[b]
For $attacks = 1 To 10
For $Attack = 1 To 13
MouseClick("left", 594,  175, 2)
Sleep(1000)
Next
MouseClick("left", 594,  175, 2)
Sleep(3500)
Next[/b]

Then to repeat the whole thing put it in a Do/Until statement with the whole thing as a Function with a Until True = False statement so that it doesn't stop. I think this will work, but since I don't play that game nor do I even have the ability to run AutoIt scripts on my work computer, I can't actualy test it. hope this helps

Share this post


Link to post
Share on other sites

Ok so this is my code:

Do
Func Bot()
While 1
Sleep(2000); script start delay
; healing
MouseClick("left", 415,  104, 2); view city
Sleep(1000)
MouseClick("left", 434,  351, 2); tavern
Sleep(1000)
MouseClick("left", 415,  191, 2); rest
Sleep(1500)
; select monster levels
MouseClick("left", 71,  410, 2); battle
Sleep(1000)
MouseClick("left", 696,  201, 2); monster
Sleep(1000)
MouseClick("left", 640,  156, 1); dropdown
Sleep(1000)
Send("{DOWN DOWN}")
Sleep(10)
Send("{Enter}")
Sleep(100)
MouseClick("left", 510,  180, 2); hunt
Sleep(1500)
For $Attacks = 1 To 10
; atack monsters (1-3)
MouseClick("left", 422,  191, 2); attack (one)
Sleep(1000)
MouseClick("left", 422,  224, 2); attack (two)
Sleep(1000)
MouseClick("left", 422,  255, 2); attack (three)
Sleep(1500)
; kill (14 atacks)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1000)
MouseClick("left", 594,  175, 2)
Sleep(1500)
; hunt more
MouseClick("left", 538,  275, 2); no item
Sleep(1000)
MouseClick("left", 538,  312, 2); 1 item
Sleep(1000)
MouseClick("left", 538,  338, 2); 2 items
Sleep(1000)
MouseClick("left", 538,  370, 2); 3 items
Sleep(2000)
Next
EndFunc
Sleep(9000)
WEnd
EndFunc
Until True = False

I currently get the error:

Line 2 (File "C:\..\Desktop\autoit-stuff\rfate_new.au3");

Func Bot()

Error: "Do" statement has no matching "Until" statement.

Share this post


Link to post
Share on other sites

hmmm, I don't know why it's doing that. i just transfered to mine and get the same error. Maybe somebody can enlighten us both

Share this post


Link to post
Share on other sites

You should run Tidy on it in SciTE editor.... you'll see multiple EndFunc for 1 Func, and you'll see you put a function inside a loop (a no no)

1. You don't even need the Do loop because when you call the function, you have a never ending loop inside of the function that has no escape.

2. If you took that loop out (the While/WEnd) then you had better use a Return statement before you get a recursion error.

Corrected, but still not logically correct

Do
    Bot()
Until True = False
Func Bot()
    While 1
        Sleep(2000); script start delay
        ; healing
        MouseClick("left", 415, 104, 2); view city
        Sleep(1000)
        MouseClick("left", 434, 351, 2); tavern
        Sleep(1000)
        MouseClick("left", 415, 191, 2); rest
        Sleep(1500)
        ; select monster levels
        MouseClick("left", 71, 410, 2); battle
        Sleep(1000)
        MouseClick("left", 696, 201, 2); monster
        Sleep(1000)
        MouseClick("left", 640, 156, 1); dropdown
        Sleep(1000)
        Send("{DOWN DOWN}")
        Sleep(10)
        Send("{Enter}")
        Sleep(100)
        MouseClick("left", 510, 180, 2); hunt
        Sleep(1500)
        For $Attacks = 1 To 10
            ; atack monsters (1-3)
            MouseClick("left", 422, 191, 2); attack (one)
            Sleep(1000)
            MouseClick("left", 422, 224, 2); attack (two)
            Sleep(1000)
            MouseClick("left", 422, 255, 2); attack (three)
            Sleep(1500)
            ; kill (14 atacks)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1000)
            MouseClick("left", 594, 175, 2)
            Sleep(1500)
            ; hunt more
            MouseClick("left", 538, 275, 2); no item
            Sleep(1000)
            MouseClick("left", 538, 312, 2); 1 item
            Sleep(1000)
            MouseClick("left", 538, 338, 2); 2 items
            Sleep(1000)
            MouseClick("left", 538, 370, 2); 3 items
            Sleep(2000)
        Next
        Sleep(9000)
    WEnd
    Return 1
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

and i wasn't disappointed

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  
Followers 0