I was working on a powercutter today and I can't seem to fix a Type Mismatch error. Don't go calling me a noob because I know what a Type Mismatch is although I don't know what I'm missing. If you think that there is a better function than FindMSColorTol then by all means tell me. Any help is appreciated, weather it be with this particular error, any error that you see coming up, or the script in general. Thanks in advance!
Here is the script--
SCAR Code:
program SSTreeEaterV2;
{.include SRL\SRL.scar}
{.include SRL\SRL\skill\WoodCutting.scar}
var Loads, cut, trips : integer; //Loads = Current Amount. Trips = Amount Wanted
TreeType : string; //Reg, Oak, Willow....
TreeFound : boolean; //In TreeFinding procedure
TreeColor, FindColorX, FindColorY : TStringArray;
procedure Setup;
begin
SetupSRL;
SetArrayLength(TreeColor,3);
SetArrayLength(FindColorX,10);
SetArrayLength(FindColorY,10);
if (LoggedIn = false) then
begin
ClearReport;
writeLn('You are not logged in. Please login before running this script.');
Exit;
end
Mouse(297,490,5,5,false); //Turns Clan Chat On. Just Temporary. Its my peace of mind.
end;
//-----------------------------------------------//
procedure FindTreeColor;
var i,q:integer;
begin
TreeFound := false;
for i := 0 to 2 do
begin
if TreeFound = true then break;
If FindMSColorTol(x,y,treecolor[i],3) then //<----- There is the error!!!
MMouse(x,y,5,5);
If GetUpText(TreeType) then
begin
ChopTree;
TreeFound:= true;
end
end
If TreeFound = false then
begin
i:=0;
for i = 0 to 9
FindColorX[i]:= Random(517);
FindColorY[i]:= Random(377);
MMouse(FindColorX,FindColorY,0,0);
if isUpText(TreeType) then
begin
TreeColor[0]:=GetColor(x,y);
writeLn('Using ' + inttostr(TreeColor[0] + ' as Tree Color 1 / 3.');
MMouse(FindColorX,FindColorY,3,3);
if isUpText(TreeType) then
begin
TreeColor[1]:=GetColor(x,y);
writeLn('Using ' + inttostr(TreeColor[1] + ' as Tree Color 2 / 3.');
end
MMouse(FindColorX,FindColorY,5,5);
if isUpText(TreeType) then
begin
TreeColor[2]:=GetColor(x,y);
writeLn('Using ' + inttostr(TreeColor[2] + ' as Tree Color 3 / 3.');
end
ChopTree;
break;
end
end;
//-----------------------------------------------//
procedure ChopTree;
begin
//Haven't done it yet!!!
end;
//-----------------------------------------------//
procedure ProgReport;
begin
ClearReport;
writeLn(' ________ ________');
writeLn(' / / / /');
writeLn(' / _____/ / _____/');
writeLn(' \_____ \ \_____ \');
writeLn(' / / / /');
writeLn(' /________/ /________/ Tree Eater');
writeLn(' Total Loads : ' + inttostr(Loads) + ' Total Logs Cut : ' + inttostr(cut));
end;
//-----------------------------------------------//
begin
Setup;
repeat
FindTreeColor;
until (Loads = Trips)
end.
And the error, marked in the script on line 32--
SCAR Code:
Line 33: [Error] (14847:39): Type mismatch in script C:\Program Files\SCAR 3.11\Scripts\SSTreeEaterV2.scar