Sign in to follow this  
Followers 0
ciraco

help with simple bot please!

7 posts in this topic

Hello, I am new to AutoIt and have no past scripting exp of this type, however I do know html and php.

I would like to create a web based browser bot that will do some very simple things (click on specific screen cords X amount of times, with a short delay between each click, then click some other things and restart (loop) at the end.

The online rpg I would like to create the bot for is called R-Fate (http://www.r-fate.com/index.php), I tried making a script to test just to see if it would work and where it would click but it gave an error.

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Sleep($MidSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
Reloadbot()

If anyone could be so kind as to assist me or point me into the correct direction, it would be much appreciated!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I use this routine in one of my progs - it might help you as it shows how to do mouse clicks and how to move the pointer.

Write out exactly what you want to do and I'll try to code it for you if you are stuck - I'm a noob but I think I can do the simple stuff you require.

; DefTimeout() does the mouse clicks
Func DefTimeout($name, $position)
    If WinExists($name) Then
        WinActivate($name, "") 
        WinWaitActive($name)
        WinMove($name, "", 0, 0, 200, 350)
        Sleep(5000)
        MouseMove(100, 300, 0); start position
        Sleep(200)
        MouseDown("left"); click for stand up
        Sleep(200)
        MouseUp("left")
        Sleep(3000)
        WinActivate($name, "")
        WinWaitActive($name)
        WinMove($name, "", 0, $position, 0, 0)
        if $Minim = 1 then
            WinSetState($name, "", @SW_MINIMIZE)
        endif
    endif
EndFunc; end of DefTimeout function
Edited by ToyleY

Share this post


Link to post
Share on other sites

Hello, I am new to AutoIt and have no past scripting exp of this type, however I do know html and php.

I would like to create a web based browser bot that will do some very simple things (click on specific screen cords X amount of times, with a short delay between each click, then click some other things and restart (loop) at the end.

The online rpg I would like to create the bot for is called R-Fate (http://www.r-fate.com/index.php), I tried making a script to test just to see if it would work and where it would click but it gave an error.

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Sleep($MidSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
MouseClick("left", 594,  175, 2)
Sleep($ShortSleep)
Reloadbot()

If anyone could be so kind as to assist me or point me into the correct direction, it would be much appreciated!

If thats your whole code then you forgot to initialize $MidSleep and $ShortSleep.

You could also try

Opt("MouseClickDelay", 10) ; add this to very beggining of script, change 10 to whatever $shortsleep is and subtract this from $midsleep.
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Sleep($MidSleep)
MouseClick("left", 594,  175, 2)
MouseClick("left", 594,  175, 2)

Reloadbot()

To trim down the code abit

Share this post


Link to post
Share on other sites

Ok, I got it to click and what not with the correct timing, but I kept getting errors with the pause, terminate and restart bot commands, so I removed them.

I also came accrost an issue with a dropdown menu and i need to have the bot press the down arrow and enter to select the correct setting, and i have no clue how to do it.

I would however like the script to repeat the entire process over and over.

Here is my code: very noob I know :)

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

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, 2); dropdown
Sleep(1000)
MouseClick("left", 640,  192, 2); 5-10 class
Sleep(1000)
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 (10 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(1500)

Reloadbot()

Thanks for the help!

Share this post


Link to post
Share on other sites

To repeat, put your script in a loop

While 1
;Your script
WEnd

Share this post


Link to post
Share on other sites

And how would I make it hit enter?

Send("{ENTER}")

like this?

Share this post


Link to post
Share on other sites

And how would I make it hit enter?

Send("{ENTER}")

like this?

Yes

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