Jump to content

Having a few problems compiling my bot


Recommended Posts

I'm having some problems compiling my bot. :/ I used Tidy so you can see the errors I'm having.

This bot is for Pets, a facebook application that basically involves too much clicking and not much else.

HotKeySet("{ESC}", "Terminate")
$answer = MsgBox(4, "Bot", "This script will run the bot.  Press Esc to exit.  Run?")

If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK.  Bye!")
    Exit
EndIf


Do
; I would like this script to ...
    MouseClick("left", 491, 253, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 373, 1)
    Sleep(2000); ... healx3 then fight
    $var = PixelGetColor(292, 414); ... then check to see if 292, 414 is the right color (the right enemy) ...
    While True
        If $var = 1381653 Then; ... and if so...
            MouseClick("left", 427, 656, 1);click fight
            Sleep(2000); wait to load
            MouseMove(484, 628, 0);move over attack
            Send("{F1}");attack spam for 2 seconds
            Sleep(2000)
            Send("{F2}");stop attack spam
            Sleep(2000);
;### Tidy Error -> "until" is closing previous "if"
        Until False; ... Also I would ilke it to repeat from the beginning after it finishes the fights
;### Tidy Error -> "else" is closing previous "while"
    Else; ... If not ...
        MouseClick("left", 552, 652, 1);evade
        leep (2000);wait to load
;### Tidy Error -> "endif" is closing previous "while"
    EndIf
    $var = PixelGetColor(292, 414)
;### Tidy Error -> "wend" is closing previous "do"
WEnd; ... and then repeat at "If $var = 0x161616 ...

Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

Thanks for the [autoit..] code herewasplato

Edited by Roman9
Link to comment
Share on other sites

...Sorry, I don't know how to make the code colored :whistle:

Manually add code tags like this:

[autoit ]

; paste code here

[/autoit ]

...just remove the spaces from the tags.

Members are helping Jon to get the editor button working again after a forum software upgrade.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

WEnd belongs to While

Until belongs to Do

You have until and WEnd in bad order in your script.

I switched them around and it still didn't work. I think I just majorly messed up the order and usage of my loops :whistle: I may have to restructure it.

If anyone could see a quick fix that would be great, if not I guess I'll just think some more after work :/

Thanks though

Link to comment
Share on other sites

You just need to learn how to use loops properly :whistle: The help file is a useful guide in learning how the different loops work. There are also lots of good examples of nested loop statements here in the forums. This might do what you're trying to accomplish:

HotKeySet("{ESC}", "Terminate")
$answer = MsgBox(4, "Bot", "This script will run the bot.  Press Esc to exit.  Run?")

If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK.  Bye!")
    Exit
EndIf


While 1
    ;----------------Heal--------------------
    MouseClick("left", 491, 253, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 373, 1)
    Sleep(2000)
    If PixelGetColor(292, 414) = 1381653 Then
        ;----------------Fight--------------------
        MouseClick("left", 427, 656, 1)
        Sleep(2000)
        MouseMove(484, 628, 0)
        Send("{F1}")
        Sleep(2000)
        Send("{F2}")
        Sleep(2000)
    Else
        ;----------------Evade--------------------
        MouseClick("left", 552, 652, 1)
        sleep(2000)
    EndIf
WEnd

Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

Edit: had a "leep(2000)" instead of a sleep O.o

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Not quite, you see after Evade I want it to restart at "If PixelGetColor(292, 414) = 1381653 Then" and after Fight I want it to restart at the begining.

How would I go about doing that?

So here's what it would do:

Heal and search for monster <-- 1 part

Check if monster is correct, if it is the right monster, fight. If not, evade. <- 2nd part

If Fight do some fighting and restart at the begining of the script. <- 3rd part

If Evade restart from checking if the monster is correct. (what evade does is find a new monster to fight, so I want to check if it is the right one to fight this time)

Loop indefenitly or until escape is pressed.

Edited by Roman9
Link to comment
Share on other sites

Again, you just need to sort out your loops. Please check the help file or search the forums for more info. If you can write out exactly what you want your script to do, it's easy to build a general script:

Heal()
While 1
    If PixelGetColor(292, 414) = 1381653 Then
        Fight()
        Heal()
    Else
        Evade()
    EndIf
WEndoÝ÷ Ù.z0{¶¡£ax,².Ø(²+×­é¢7~æjÖ(¹Æ§vkzÛrç!j|­)àÂ+a!ñ%±äázv§uhbéh¢·ly«"z»h究¶á£¨º·(uè¬Âäx"*.²)©'òÙbæ¢÷~׫¶­ë-~)e|¨º·îËb¢{ºÚ"µÍ[ÈX[

B[ÝÙPÛXÚÊ  ][ÝÛY ][ÝË
LKLËJBÛY

B[ÝÙPÛXÚÊ  ][ÝÛY ][ÝË
LKÌËJBÛY

B[ÝÙPÛXÚÊ  ][ÝÛY ][ÝË
LKÌËJBÛY

B[ÝÙPÛXÚÊ  ][ÝÛY ][ÝË
LKÍÌËJBÛY

B[[Â[ÈYÚ

B[ÝÙPÛXÚÊ  ][ÝÛY ][ÝË
Ë
MJBÛY

B[ÝÙS[ÝJ



BÙ[
    ][ÝÞÑ_I][ÝÊBÛY

BÙ[
    ][ÝÞÑI][ÝÊBÛY

B[[Â[È]YJ
BS[ÝÙPÛXÚÊ ][ÝÛY ][ÝË
ML
LJBÛY

B[[

Now I don't know if that's all the way you want it or not, but I really hope you can figure it out from here :whistle:

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Oooher that's pretty cool. Thanks for that! :whistle:

Well I had gotten it to work adding a Do.. Until loop by reading the help files :lmao:

HotKeySet("{ESC}", "Terminate")
$answer = MsgBox(4, "Bot", "This script will run the bot.  Press Esc to exit.  Run?")
$var = 1

If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK.  Bye!")
    Exit
EndIf


While 1
    ;----------------Heal--------------------
    MouseClick("left", 491, 253, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 273, 1)
    Sleep(2000)
    MouseClick("left", 491, 353, 1)
    Sleep(2000)
    Do
        If PixelGetColor(294, 412) OR PixelGetColor(295, 447) = 1381653 Then
            ;----------------Fight--------------------
            MouseClick("left", 427, 656, 1)
            MouseClick("left", 427, 670, 1)
            Sleep(2000)
            MouseMove(484, 628, 0)
            Send("{F1}")
            Sleep(2000)
            Send("{F2}")
            Sleep(2000)
        Else
            ;----------------Evade--------------------
            MouseClick("left", 552, 652, 1)
            MouseClick("left", 552, 670, 1)
            Sleep(2000)
        EndIf
    Until $var = 2
WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

However, I'll probably compress it to be like your!

Thanks ;)

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