Log in

View Full Version : Where Can I Find The Non-SRL Functions?



Gearsnare
04-20-2009, 06:53 AM
Where can I find things like FindDTMRotated so I can look out how their coded as it helps me to understand how to use them.

Thanks

Harry
04-20-2009, 07:00 AM
Hit F1 in SCAR. It will open the SCAR Manual, with all functions. You can then CTRL + F for the functions you need.

NiCbaZ
04-20-2009, 01:19 PM
Where can I find things like FindDTMRotated so I can look out how their coded as it helps me to understand how to use them.

Thanks

Scars functions are closed source.

cathering_
04-20-2009, 01:49 PM
Hit CTRL + SPACE on the main scar window (code window) to view the whole list of functions that are in SCAR including ones which are not in the SCAR manual although it does not tell you how to use them, it gives information on the variables that you can use.

NiCbaZ
04-20-2009, 08:10 PM
HE wants to read the functions c0de so he can learn, freddy does not permit this, so theres no point trying.

Nava2
04-20-2009, 08:19 PM
Closed sauce is closed.

Try the help manual though, I just bookmark is personally. :)

Wizzup?
04-20-2009, 08:19 PM
I wrote this once, for fun. It is not optimised at all, but it should give you the general idea.


pDTM = record
p: TPointArray;
c, t, asz, ash: TIntegerArray;
end;

Function AreaShape(Color, Tolerance, Size, Shape: Integer; P: TPoint) : Boolean; inline;

Var
X, Y, S: Integer;
Begin
Case Shape Of
dtm_Rectangle:
Begin
{
Example:
3x3
X X X
X X X
X X X
}
For X := P.X - Size To P.X + Size Do
For Y := P.Y - Size To P.Y + Size Do
If SimilarColors(GetColor(X, Y), Color, Tolerance) Then
Begin
Result := True;
Exit;
End;
End;

dtm_Cross:
{
Example:
3x3
X
X X X
X
}
Begin
For X := P.X - Size To P.X + Size Do
If SimilarColors(GetColor(X, P.Y), Color, Tolerance) Then
Begin
Result := True;
Exit;
End;
For Y := P.Y - Size To P.Y + Size Do
If SimilarColors(GetColor(P.X, Y), Color, Tolerance) Then
Begin
Result := True;
Exit;
End;
End;

dtm_DiagonalCross:
{
Example:
3x3
X X
X
X X

}
Begin
For S := -Size To Size Do
Begin
If SimilarColors(GetColor(P.X + S, P.Y + S), Color, Tolerance) Then
Begin
Result := True;
Exit;
End;
If SimilarColors(GetColor(P.X + S, P.Y - S), Color, Tolerance) Then
Begin
Result := True;
Exit;
End;
End;
End;

{4:
Begin
D := Ceil(Sqrt(Pow(Size, 2) + Pow(Size, 2)));
//Will finish later

End; }

Else
WriteLn('Incorrect Shape');
End;
Result := False;
End;

{
}

Function pFindDTMRotated(DTM: pDTM; Var x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; Var aFound: Extended): Boolean;

Var
mP: TPointArray;
I, J, H, dH, R, W: Integer;
Angle: Array Of Extended;
tAngle: Extended;
Found: Boolean;
TempTP: TPoint;

Begin
For I := 1 To High(DTM.p) Do
Begin
DTM.p[I].x := DTM.p[I].x - DTM.p[0].x;
DTM.p[I].y := DTM.p[I].y - DTM.p[0].y;
End;

// X2 := X2 - MaxSubPointDist.X
// Y2 := Y2 - MaxSubPointDist.Y
// X1 := X1 + MaxSubPointDist.X
// Y1 := Y1 + MaxSubPointDist.Y
// If X2 > X1 Then Exit
// If Y2 > Y1 Then Exit
// Will make sure there are no out of bounds exceptions, and will make it faster
FindColorsTolerance(mP, DTM.c[Low(DTM.c)], x1, y1, x2, y2, DTM.t[Low(DTM.t)]);
H := High(mP);
dH := High(DTM.p);
For I := 0 To H Do
Begin
// Use MainPoint's AreaSize and Shape.
// For Loop on mP, depending on the AreaShape. Then on all the code beneath
// this point, use the var that is retrieved from the for loop.
Found := True;
SetLength(Angle, 0);
Found := True;
For J := 1 To dH Do
Begin
If Length(Angle) = 0 Then
Begin
tAngle := sAngle;
While tAngle <= eAngle Do
Begin
TempTP.X := DTM.p[J].X + mP[I].X;
TempTP.Y := DTM.p[J].Y + mP[I].Y;
TempTP := RotatePoint(TempTP, tAngle, mP[I].X, mP[I].Y);
If AreaShape(DTM.c[J], DTM.t[J], DTM.asz[J], DTM.ash[J], TempTP) Then
Begin
SetLength(Angle, Length(Angle) + 1);
Angle[High(Angle)] := tAngle;
Found := True;
End;
tAngle := tAngle + aStep;
End;
End;

Found := Length(Angle) > 0;

For R := 0 To High(Angle) Do
Begin
TempTP.X := DTM.p[J].X + mP[I].X;
TempTP.Y := DTM.p[J].Y + mP[I].Y;
TempTP := RotatePoint(TempTP, Angle[R], mP[I].X, mP[I].Y);
If Not AreaShape(DTM.c[J], DTM.t[J], DTM.asz[J], DTM.ash[J], TempTP) Then
Begin
For W := R To High(Angle) - 1 Do
Angle[W] := Angle[W + 1];
SetLength(Angle, Length(Angle) - 1);
If Length(Angle) = 0 Then
Begin
Found := False;
Break;
End;
End;
End;
If Not Found Then
Break;
End;

If Found Then
Begin
Result := True;
x := mP[I].X;
y := mP[I].Y;
aFound := Angle[0];
Exit;
End;
End;
Result := False;
End;

Gearsnare
04-21-2009, 03:16 AM
It's a shame their closed source, thanks alot for the codes Wizzup! It's helped me understand how to use the functions more.