Also, when using it like:
FindFishingSpot(var x, y : integer): boolean;
You have more options with the x, y values.
When creating the function, you can either have the function set variables located in the parameters to a specific value, OR you can have the function read the parameters as specific values for the function.
IE:
SCAR Code:
//In this example, I'm having the function read the two variables.
function FindFishingSpot(var x, y : integer) : boolean;
begin
if GetColor(x, y) = FishingSpotColor then begin
Result := true;
Exit;
end
else begin
WriteLn('Fishing spot not found at specified coordinates.');
end;
end;
//////////////////////////////////////////////////////////////////////////
var
FSx, FSy : integer;
begin
SetupSRL;
FSx := 213;
FSy := 417;
if FindFishingSpot(FSx, FSy) then begin
WriteLn('Fishing Spot Found');
Mouse(FSx, FSy, 5, 5, True);
wait(100 + random(250));
end;
end.
SCAR Code:
//In this example I will have the function set the variable parameters.
function FindFishingSpot(var x, y : integer) : boolean;
begin
if FindColorTolerance(x, y, FSColor, SCRx1, SCRy1, SCRx2, SCRy2, 5) then Begin
WriteLn('Fishing Spot Found.');
Result := true;
end
else Result := false;
end;
//////////////////////////////////////////////////////////////////////////
var
FSx, FSy : integer;
Begin
SetupSRL;
If FindFishingSpot(FSx, FSy) then begin
Mouse(FSx, FSy, 3, 3, true);
WriteLn('Fishing Spot Clicked.');
end;
end.
Definitely not the best example, but this should give you an idea of how these parameters work.