This part of my script keeps giving me an identifier expected error, but my number of begins and ends match up. What's wrong?
Simba Code:
function FindRock(var x, y, : Integer) : Boolean; // var x, y, : Integer parameter - Pass in two variables, they get returned if the tree is found
var
a : Integer; // a is a type of Integer
TPA : TPointArray; // each TPoint has an x/y Integer variable that can be set
ATPA : T2DPointArray; // The "2D" means it's a two dimentional array
MP : TPoint; // variable that is set to the TPoint type, named MP for Middle Point
tmpCTS : Integer; // variable that will hold what the current CTS (Color Tolerance Speed) value is before we alter it
Box : TBox; // each TBox has an X1, Y1, X2, Y2 variable that can be set
begin
if(not(LoggedIn))then Exit;
tmpCTS := GetColorToleranceSpeed; // set the tmpCTS variable to the current CTS
ColorToleranceSpeed(2); // We used a CTS of 2 in ACA to find the correct colors
SetColorSpeed2Modifiers(0.01, 1.49); // These were found in ACA
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2383809, MSX1, MSY1, MSX2, MSY2, 20); // search for a color in the area you tell it to, spiraling in an outer motion and returning all the points where it was found and add them to the TPA variable we pass in
SortTPAFrom(TPA, Point(MSCX, MSCY)); // will sort the TPA from a given point, and here we are telling it to sort it by the center of the screen (MSCX, MSCY) which is where the player is
ATPA := TPAtoATPAEx(TPA, 15, 15); // split the TPA into boxes with the h/w specified. This helps manage all the points that were found
for a := 0 to High(ATPA) do
begin
MP := MiddleTPA(ATPA[a]);
Box := IntToBox((MP.X - 20), (MP.Y - 20), (MP.X + 20), (MP.Y + 20));
{$IFDEF SMART}
SMART_DrawBoxEx(True, Box, clYellow); // check to see if the user is using SMART, and if so, draw a yellow line around the Box that I set earlier
{$ENDIF}
MMouse(MP.X, MP.Y, 4, 4); // move the mouse to the MP with a randomization of 4 for both points
if(WaitUpText('copper ore', 750))then // wait for 750 miliseconds and to check if the UpText contains "Tree". If it does, then I set the X/Y variables that are passed in to the MP.X/Y coordinates
begin
x := MP.X;
y := MP.Y;
Result := True; // if the tree is found, the result is true. functions are automatically set to false
{$IFDEF SMART}
SMART_ClearCanvas; // clears the SMART canvas if SMART is being used
{$ENDIF}
Break; // ends the loop
end;
end;
ColorToleranceSpeed(tmpCTS); // resets variable
SetColorSpeed2Modifiers(0.2, 0.2); // sets to default
end;