Eleflump Posted November 9, 2011 Share Posted November 9, 2011 ok so i it doesnt except else or end else commands, this is my script program New;var x, y: Integer; begin if findcolor(x, y, 16777214, 115, 285, 215, 285)then; begin writeLn('found it ') movemousesmooth(972, 387); clickmouse(972, 387, true); end else begin writeLn('couldnt find it, trying again'); if findcolor(x, y, 16777215, 115, 285, 215, 285)then; WriteLn('found it'); movemousesmooth(30, 1016); end; Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 9, 2011 Share Posted November 9, 2011 U should properly indent your script: program New; var x, y: Integer; begin if FindColor(x, y, 16777214, 115, 285, 215, 285) then begin WriteLn('found it ') MoveMouseSmooth(972, 387); ClickMouse(972, 387, true); end else begin WriteLn('couldnt find it, trying again'); if FindColor(x, y, 16777215, 115, 285, 215, 285) then begin WriteLn('found it'); MoveMouseSmooth(30, 1016); end; end; end. Quote Link to comment Share on other sites More sharing options...
Eleflump Posted November 9, 2011 Author Share Posted November 9, 2011 But when I try to run it says identifier expected on whatever line else is Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 9, 2011 Share Posted November 9, 2011 Am I reading this right? You are checking for a color in one spot, then ignoring the location it was found in, and specifying the location to click at? Freddy's version compiles just fine. In fixing up your indenting he fixed another error along the way. You don't put a ; after the then statement. The compiler doesn't like it. if findcolor(x, y, 16777214, 115, 285, 215, 285)then; I highly recommend you get into the habit of indenting your code. Once a script gets beyond a few lines it becomes a nightmare to maintain if you don't. Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 10, 2011 Share Posted November 10, 2011 Am I reading this right? You are checking for a color in one spot, then ignoring the location it was found in, and specifying the location to click at? Freddy's version compiles just fine. In fixing up your indenting he fixed another error along the way. You don't put a ; after the then statement. The compiler doesn't like it. I highly recommend you get into the habit of indenting your code. Once a script gets beyond a few lines it becomes a nightmare to maintain if you don't. Wasn't just that... There's also "end." missing. I figured the "MoveMouseSmooth(30, 1016);" probably belonged inside of the last if statement. Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted November 10, 2011 Share Posted November 10, 2011 Wasn't just that... There's also "end." missing. I figured the "MoveMouseSmooth(30, 1016);" probably belonged inside of the last if statement.You're right on both counts. Missed that. Quote Link to comment Share on other sites More sharing options...
Eleflump Posted November 10, 2011 Author Share Posted November 10, 2011 I'm trying to write: if you find a color here, Click there, if you dont find it look in a different area and if it's there click on it Quote Link to comment Share on other sites More sharing options...
FHannes Posted November 10, 2011 Share Posted November 10, 2011 Sounds like this: program New; var x, y: Integer; begin if FindColor(x, y, 16777214, 115, 285, 215, 285) then begin WriteLn('found it ') MoveMouseSmooth(x, y); ClickMouse(x, y, true); end else begin WriteLn('couldnt find it, trying again'); if FindColor(x, y, 16777215, 115, 285, 215, 285) then begin WriteLn('found it'); MoveMouseSmooth(x, y); ClickMouse(x, y, true); end; end; end. Quote Link to comment Share on other sites More sharing options...