Sign in to follow this  
Followers 0
Yoon

2 Errors EndIf & Unable to parse line

9 posts in this topic

#1 ·  Posted (edited)

Ok.

While 1
 *  If Hex(PixelGetColor(312, 37),6) = "EDF0F3" *Then
$coord = PixelSearch( 100, 100, 1280, 950, 0xFF8000, 1, 2);Orange Monsters
If Not @error Then
 * *MouseMove($coord[0],$coord[1],0)
 * *MouseClick("right",$coord[0],$coord[1])
 * *Sleep (50)
    EndIf
    Send("{Right 4}")
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Send("{Right 4}")
Sleep(100)
Send("{Space}")
Sleep(100)
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("6")
Send("{Space}")
Send("{Right 4}")
$coord = PixelSearch( 100, 100, 1280, 950, 0xFFFF00, 1, 2);Yellow Monsters
If Not @error Then
 * *MouseMove($coord[0],$coord[1],0)
 * *MouseClick("right",$coord[0],$coord[1])
 * *Sleep (50)
EndIf
Send("{Right 4}")
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("{Space}")
Sleep(100)
Send("1")
Sleep(100)
Send("{Right 4}")
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("6")
Send("{Space}")
Send("{Shift}")
Send("{Right 4}")
Send("{Strg}")
EndIf;<---- This is the one I removed. 
WEnd

Ok so I have this script But I keep receiving the EndIf has no If statement. So I removed the Final EndIf due to the fact it was an extra EndIf With no If Function. So I believe I may of fixed that problem but not 100% sure. Problem is when I Run the code after removing the extra EndIf Statement I receive this error.

/whatever.au3 (2) : ==> Unable to parse line.:

* If Hex(PixelGetColor(312, 37),6) = "EDF0F3" *Then

^ ERROR

Not sure what the issue is. The AU3 will not run due to the error obviously.

Any help would be awesome.

Thank you.

*edit*

I also tried using

Hex(PixelGetColor(312, 37) dex= "EDF0F3"

Same issue.

Edited by Yoon

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Is this too obvious :)

Remove the "*" at the begining of code lines or replace with ";" or comment code blocks with #cs #ce.

Edited by picaxe

Share this post


Link to post
Share on other sites

Can you show me an example? Because I thought the stars were correct.

I do not follow.

Share this post


Link to post
Share on other sites

Can you show me an example? Because I thought the stars were correct.

I do not follow.

I have never seen any Autoit code using an asterisk unless it was using wildcard for a filename. Just erase the asterisks and it should work fine.

Share this post


Link to post
Share on other sites

it worked for the error, got something new... of course :)

While 1
If Hex(PixelGetColor(312, 37),6) = "EDF0F3" *Then
$coord = PixelSearch( 100, 100, 1280, 950, 0xFF8000, 1, 2);Orange Monsters
If Not @error Then
MouseMove($coord[0],$coord[1],0)
MouseClick("right",$coord[0],$coord[1])
Sleep (50)
EndIf
Send("{Right 4}")
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Send("{Right 4}")
Sleep(100)
Send("{Space}")
Sleep(100)
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("6")
Send("{Space}")
Send("{Right 4}")
$coord = PixelSearch( 100, 100, 1280, 950, 0xFFFF00, 1, 2);Yellow Monsters
If Not @error Then
MouseMove($coord[0],$coord[1],0)
MouseClick("right",$coord[0],$coord[1])
Sleep (50)
EndIf
Send("{Right 4}")
Send("1")
Sleep(100)
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("{Space}")
Sleep(100)
Send("1")
Sleep(100)
Send("{Right 4}")
Send("2")
Sleep(100)
Send("3")
Sleep(100)
Send("4")
Sleep(100)
Send("6")
Send("{Space}")
Send("{Shift}")
Send("{Right 4}")
Send("{Strg}")
WEnd

\whatever.au3 (63) : ==> "Wend" statement with no matching "While" statement.:

WEnd

Share this post


Link to post
Share on other sites

You might try indenting code so you can see where you do and don't have the correct tokens. You are missing an EndIf somewhere.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

WEnd? Or EndIf.... if its EndIf Might it be right before the WEnd?

*Edit*

NM that I tried the EndIF where I had it before but removed it. In my 1st code post, returned another error completely.

The problem seems to be with the WEnd.

Edited by Yoon

Share this post


Link to post
Share on other sites

Use "Tools, Tidy AutoIt Source" in Scite to indent your code. I can't test what you are trying to do, maybe something like this

While 1
    If Hex(PixelGetColor(312, 37), 6) = "EDF0F3"  Then
        $coord = PixelSearch(100, 100, 1280, 950, 0xFF8000, 1, 2);Orange Monsters
        If Not @error Then
            MouseMove($coord[0], $coord[1], 0)
            MouseClick("right", $coord[0], $coord[1])
            Sleep(50)
        EndIf
        Send("{Right 4}")
        Send("1")
        Sleep(100)
        Send("2")
        Sleep(100)
        Send("3")
        Sleep(100)
        Send("4")
        Send("{Right 4}")
        Sleep(100)
        Send("{Space}")
        Sleep(100)
        Send("1")
        Sleep(100)
        Send("2")
        Sleep(100)
        Send("3")
        Sleep(100)
        Send("4")
        Sleep(100)
        Send("6")
        Send("{Space}")
        Send("{Right 4}")
        $coord = PixelSearch(100, 100, 1280, 950, 0xFFFF00, 1, 2);Yellow Monsters
        If Not @error Then
            MouseMove($coord[0], $coord[1], 0)
            MouseClick("right", $coord[0], $coord[1])
            Sleep(50)
        EndIf
        Send("{Right 4}")
        Send("1")
        Sleep(100)
        Send("2")
        Sleep(100)
        Send("3")
        Sleep(100)
        Send("4")
        Sleep(100)
        Send("{Space}")
        Sleep(100)
        Send("1")
        Sleep(100)
        Send("{Right 4}")
        Send("2")
        Sleep(100)
        Send("3")
        Sleep(100)
        Send("4")
        Sleep(100)
        Send("6")
        Send("{Space}")
        Send("{Shift}")
        Send("{Right 4}")
        Send("{Strg}")
    EndIf
WEnd

Share this post


Link to post
Share on other sites

Worked great and TY VM I just hope I absorb what I learned here

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