Im trying to use AutoColor(srl_TreeColor) and I occationally run into an error
colortree := AutoColor(srl_TreeColor);
results in Math error at line 239 in color.scar, function GetColorArrayInfo.
the line is
Result[i][ii][2] := Result[i][ii][2] / h;
Printable View
Im trying to use AutoColor(srl_TreeColor) and I occationally run into an error
colortree := AutoColor(srl_TreeColor);
results in Math error at line 239 in color.scar, function GetColorArrayInfo.
the line is
Result[i][ii][2] := Result[i][ii][2] / h;
I can't seem to produce the same error you are having. Could you possibly post the script or send it to me through e-mail?
You have the Script :)
Simba Code://-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- AutoColorFinding Routines --//
//-----------------------------------------------------------------//
// * procedure SetupAutoColors;
// * function LoadColorArray(Which: Integer): TIntegerArray;
// * function LoadAutoColor(which: Integer; var theAC: TAutoColorInfo): Boolean;
// * function AutoColorEx(which: Integer): TAutoColorInfo;
// * function AutoColor(which: Integer): Integer;
//-----------------------------------------------------------------//
{ const AutoColor Constants;
Description: Constants representing the different types of AutoColors }
const
srl_AutoColorCount = 13;
srl_VarrockRoadColor = 0;
srl_LumbridgeRoadColor = 1;
srl_FaladorRoadColor = 2;
srl_AlKharidRoadColor = 3;
srl_DarkDirtRoadColor = 4;
srl_LightDirtRoadColor = 5;
srl_SandColor = 6;
srl_WaterColor = 7;
srl_SwampWaterColor = 8;
srl_LadderColor = 9;
srl_RockColor = 10;
srl_MineRockColor = 11;
srl_TreeColor = 12;
~BraK
No, Brak.
I need to take a look at his script to see what is causing the problem.
I just tried the function with colour 0 instead of AutoColoring, and I didnt get the error, but Im standing in draynor bank. Tried it with AutuColor and it did it again.Code:function gettrees(var ptr: TPoint): boolean;
var
tpatree, tpatreebest: TPointArray;
atpatree: array of TPointArray;
i, colortree: Integer;
ptree: TPoint;
begin
result := false;
if not LoggedIn then exit;
ptr := point(-1, -1);
colortree := AutoColor(srl_TreeColor);
findColorsTolerance(tpatree, colortree, mmx1, mmy1, mmx2, mmy2, 15);
DebugTPA(tpatree, 'a');
wait(2000);
if high(tpatree) = 0 then writeln('nope');
FilterPointsPie(tpatree, 180, 265, 10, 70, mmcx, mmcy);
DebugTPA(tpatree, 'mmtrees');
atpatree := SplitTPA(tpatree, 15);
for i := 0 to high(atpatree) do
if high(atpatree[i]) > high(tpatreebest) then
tpatreebest := atpatree[i];
DebugTPA(tpatreebest, 'tpatree');
if length(tpatreebest) < 1 then
exit;
writeln('a')
ptr := MiddleTPA(tpatreebest)
result := true;
end;
Could you send me the full script to examine? I am still not getting any error.
Is this a script you wrote, or did someone else write this?
edit: nvm its working now o_O, maybe my shits just going crazy.
I'd rather not, but if I dont work it out Ill post it here. Im just reworking an old script and thats the only new procedure.
If anyones having this same error, http://villavu.com/forum/showpost.ph...1&postcount=16 FindTreeColor still works (haha after 2 years :rolleyes:)
"Math Errors" are typically when you divide by the wrong type or zero.. but divide by zero is said as such.. I'm wondering if it was NaN or something similar? Perhaps I did not initialize the variables correctly.