Results 1 to 3 of 3

Thread: AddTPAs function that I made not working

  1. #1
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default AddTPAs function that I made not working

    Hey guys jsut made this function Heres what it does.

    SCAR Code:
    {By Freakymonkey. This function use the  variety of colors given and
    tries to find them and save them into individual TPAs.  Then it combines the TPAS into
    one SINGLE TPA.

    XX, YY; Point from where to start searching for colors
    TPA : TPointArray in which all colors are saved
    Colors: Colors that save into the TPAs
    Tol: Tolerance
    X1, Y1, X2, Y2: Area in which to find the colors
    Results Boolean }


    function AddTPAS(XX, YY: Integer; TPA: TPointArray; Colors: TIntegerArray; Tol, X1, Y1, X2, Y2: Integer): Boolean;


    however, it compiles but when it combines the TPAs and then ends the function the Length of the combined TPA is 0! Here is the whole script, plz help me

    SCAR Code:
    function AddTPAS(XX, YY: Integer; TPA: TPointArray; Colors: TIntegerArray; Tol, X1, Y1, X2, Y2: Integer): Boolean;

    Var v, c: Integer;
    Var TPAS: T2DPointArray;

    begin
      Result := False;
      if Length(Colors) < 0 then Exit;
      SetArrayLength(TPAS, Length(Colors));
      for v := 0 to High(TPAS) -1 do
        FindColorsSpiralTolerance(XX, YY, TPAS[v], Colors[v], X1, Y1, X2, Y2, Tol);
      TPA := CombineTPA(TPAS[0], TPAS[1]);
      if Length(COlors) = 2 then
      begin
        Result := True;
        Exit;
      end;
      for v := 2 to High(TPAS) - 1 do
        TPA := CombineTPA(TPA, TPAS[v]);
      Result := True;
    end;

    I'm sure there mgith be another function out there like this but I would REALLy like it if you guys could help me make this function work decently

  2. #2
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    heh.

    SCAR Code:
    function AddTPAS(var TPA: TPointArray; XX, YY: Integer; Colors: TIntegerArray; Tol, X1, Y1, X2, Y2: Integer): Boolean;

    because as it was TPA was a local variable, and you need it to be one that is passed to the function, changed and passed back.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  3. #3
    Join Date
    Jan 2008
    Location
    Stanford, CA
    Posts
    329
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    oh ok thanks Rasta Rep +

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. this function i made for munk killer
    By jhildy in forum OSR Help
    Replies: 8
    Last Post: 08-12-2007, 11:14 AM
  2. I made a function :D
    By Jason2gs in forum News and General
    Replies: 5
    Last Post: 03-10-2007, 08:16 PM
  3. *brakeing news* my apprinice made a working script!
    By newguy45 in forum News and General
    Replies: 8
    Last Post: 06-29-2006, 03:24 PM

Posting Permissions

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