AutoIT Loop/If help needed

06/25/2010 01:17 EmilAbra#1
Hello, I'm trying out some AutoIT programming for the first time.

I'm trying to make a very simple mining bot but i got stuck, here's the code for the loop where i am stuck:

PHP Code:
While 1
            $coord0 
PixelSearch ($pos0[0], $pos0[1], $pos1[0], $pos1[1], 0xD6A252); Search for CopperOre
            
If Not @error Then MouseClick ("left"$coord0[0], $coord0[1], 115)
                
Sleep (500)
                
MouseClick ("left"450450120); Drop CopperOre
                Sleep 
(2000)
            
$coord0 PixelSearch ($pos0[0], $pos0[1], $pos1[0], $pos1[1], 0x4A494A); Search for IronOre
            
If Not @error Then MouseClick ("left"$coord0[0], $coord0[1], 115)
                
Sleep (500)
                
MouseClick ("left"450450120); Drop IronOre
                Sleep 
(2000)            
        
WEnd 
As it is now it searches for the ores but if there aren't any it clicks the 450,450 pixel anyway, which makes the character move. I need help to come up with a solution for this - how can I make it not do anything when it cannot find the ores?

Thanks in advance
06/26/2010 11:33 trash#2
theres no endif's
06/26/2010 17:03 EmilAbra#3
Quote:
Originally Posted by trash View Post
theres no endif's
Problem is, if I put EndIf I get an error telling me there are EndIf's without matching If functions... Any clue?