Results 1 to 8 of 8

Thread: Where Can I Find The Non-SRL Functions?

  1. #1
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Where Can I Find The Non-SRL Functions?

    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
    SCAR Code:
    if (YourActivity = 'ReadingThis') then
        Inc(ViewCount);

  2. #2
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    Hit F1 in SCAR. It will open the SCAR Manual, with all functions. You can then CTRL + F for the functions you need.


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  3. #3
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Gearsnare View Post
    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.

  4. #4
    Join Date
    Jul 2007
    Location
    UK
    Posts
    307
    Mentioned
    0 Post(s)
    Quoted
    5 Post(s)

    Default

    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.

  5. #5
    Join Date
    Sep 2006
    Location
    include srl/srl.scar ( aussie)
    Posts
    2,875
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    HE wants to read the functions c0de so he can learn, freddy does not permit this, so theres no point trying.

  6. #6
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Closed sauce is closed.

    Try the help manual though, I just bookmark is personally.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  7. #7
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    I wrote this once, for fun. It is not optimised at all, but it should give you the general idea.

    pascal Code:
    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;



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  8. #8
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's a shame their closed source, thanks alot for the codes Wizzup! It's helped me understand how to use the functions more.
    SCAR Code:
    if (YourActivity = 'ReadingThis') then
        Inc(ViewCount);

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •