Your calling variables more then twice and using them as paramaters in your procedure... I dont really understand what your doing.. But here it is, fixed.
SCAR Code:
// AutoColorProcedure {note: color=iron}
program colorfind;
const
rockcolor= 2305614; //color of rock (will use this to auto color)
//var MineCol: array [0..3] of integer;
{a,}
var
x,y: integer;
Function GetRockColor(MineCol: array [0..3] of integer): integer;
var
i: integer;
begin
if (FindColorTolerance(x, y, rockcolor, 10, 5, 416, 336, 2)) then
begin
MineCol[0] := GetColor(x+3,y+3);
MineCol[1] := GetColor(x-3,y-3);
MineCol[2] := GetColor(x-3,y+3);
MineCol[3] := GetColor(x+3,y-3);
i := Random(3) + 1;
result := MineCol[i];
end;
end;
//needed another end
begin
end.
EDIT: Would this solve all your problems???
SCAR Code:
program New;
{.include SRL/SRL.scar}
const
orecolor = 0;
Function GetRockColor(rockcolor: integer): integer;
var
MineCol: array [0..3] of integer;
i: integer;
begin
if (FindColorTolerance(x, y, rockcolor, 10, 5, 416, 336, 2)) then
begin
MineCol[0] := GetColor(x+3,y+3);
MineCol[1] := GetColor(x-3,y-3);
MineCol[2] := GetColor(x-3,y+3);
MineCol[3] := GetColor(x+3,y-3);
i := Random(3) + 1
result := MineCol[i];
end;
end;
//use like this
procedure FindTheRock;
var
NewRockColor: integer;
begin
NewRockColor := GetRockColor(orecolor);
if (FindColorSpiralTolerance(x, y, NewRockColor, msx1, msy1, msx2, msy2, 15)) then
Writeln('Found');
end;
begin
SetUpSRL;
FindTheRock;
end.