From: 3Garrett3
I find it impossible to fix any errors with MSI, I have to port out the code into a new script without the headers.
Simba counts lines (visually) like this:
1. Program new;
2. begin
3. //dostuff;
4. *compile error here*
5.end;
But reports the problem (debug box + highlighting) as this:
1. Program new;
2. begin
3. *compile error here*
4.end;
So I would be looking on line 3 for the error, etc. When you get so many headers, as MSI functions have, it builds up and I could be looking 40 or 50 lines above what the actual error is. I find it really hard to figure out where the actual error is..
This is what I've found. Nothing has been done about it. AFIAK, SCAR accounted for the headers, while Simba does not. Code like this:
{******************************************************************************}
{ Function MSI_FishingTools : TIntegerArray }
{ By: 3Garrett3 }
{ Date: 25 July 2010 }
{ Description: Figures out which tool the script needs to use }
{******************************************************************************}
Function MSI_FishingTools : TIntegerArray;
var
script: TScript;
i: Integer;
begin
script := MSI_Scripts[MSI_Players[CurrentPlayer].Scripts[CurrentScript]];
for i := 0 to High(script.Objects) do
case (script.Objects[i]) of
FISHSPOT_NET:
Result := CombineIntArray(Result, [FISH_SMALLNET]);
FISHSPOT_BAIT:
Result := CombineIntArray(Result, [FISH_ROD, FISH_BAIT]);
FISHSPOT_LURE:
Result := CombineIntArray(Result, [FISH_FLY, FISH_FEATHER]);
FISHSPOT_CAGE:
Result := CombineIntArray(Result, [FISH_CAGE]);
FISHSPOT_HARPOON:
Result := CombineIntArray(Result, [FISH_HARPOON]);
else
MSI_Debug('Invalid Fishing Spot Argument');
end;
ClearSameIntegers(Result);
end;
{******************************************************************************}
{ Function MSI_DetectWaterDirections() : TBoolArray }
{ By: 3Garrett3 }
{ Date: 24 August 2010 }
{ Description: Finds the directions of water, helping find the fishing spot }
{******************************************************************************}
Function MSI_DetectWaterDirections(var Counts : TIntegerArray) : TBoolArray; // Array - 0 = right 1 = left 2 = below 3 = above
var
ATPA : T2DPointArray;
cts, i : Integer;
begin
SetLength(ATPA, 4);
SetLength(Result, 4);
cts := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.25);
FindColorsTolerance(ATPA[0], 9602689, MSCx + 20 , MSCy - 10, MSCx + 40, MSCy + 10, 14); // To the right
FindColorsTolerance(ATPA[1], 9602689, MSCx - 40 , MSCy - 10, MSCx - 20, MSCy + 10, 14); // To the left
FindColorsTolerance(ATPA[2], 9602689, MSCx - 10 , MSCy + 30, MSCx + 10, MSCy + 50, 14); // below
FindColorsTolerance(ATPA[3], 9602689, MSCx - 10 , MSCy - 50, MSCx + 10, MSCy - 30, 14); // above
for i := 0 to 3 do
begin
Result[i] := (Length(ATPA[i]) > 200);
Counts[i] := Length(ATPA[i]);
MSI_Debug('DetectWaterDirections, direction: ' + ToStr(i) + '. Result: ' + ToStr(Result[i]) + '. WaterCount: ' + ToStr(Counts[i]));
end;
ColorToleranceSpeed(cts);
end;
Can really throw the errors off. This code would be off at least 10 lines, because there are 10 commented lines. I don't know if it accounts for blank space, but that would throw the lines off by even more. Something has to be done, this never used to happen..