Results 1 to 10 of 10

Thread: Putting two tpa's and searching cords

  1. #1
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Putting two tpa's and searching cords

    Ok some stiles for fishing lobsters is really hard to find as he has colors like his surroundings so what i thought of was what if i use two tpas for two colors then say must find Color 1 and then Color 2 from 10 to 20 x higher so it finds two diffrent colors in a line.

    Would this work? if so how could i go about it?

    Thanks

    Also if you have the time wound you mind wirting a basic basic just a couple of lines of where to go as i can build up (i learn best that way) Thanks

    E: When did i get useful poster ?
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  2. #2
    Join Date
    Jan 2008
    Location
    10° north of Hell
    Posts
    2,035
    Mentioned
    65 Post(s)
    Quoted
    164 Post(s)

    Default

    Read Sir R. Magician's Post below.
    Last edited by Dgby714; 01-14-2011 at 10:19 PM.

    Dg's Small Procedures | IRC Quotes
    Thank Wishlah for my nice new avatar!
    Quote Originally Posted by IRC
    [22:12:05] <Dgby714> Im agnostic
    [22:12:36] <Blumblebee> :O ...you can read minds

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

    Default

    Read about TPAs
    Read about WizzyPluggin

    And look for colorfinding / object finding tuts.

    You'll want to search and save two different TPAs and then you would want to use an enlarged version of MatchTPA.

    I don't know where the hell MatchTPA is anymore, but it just basically checks if two TPAs are around each other.

    TPAs are TPointArrays. Arrays of TPoint

    TPoint = record
    x, y: integer

    Simba Code:
    type
      //To be used with CTS 2
      TMultiColor = record
        Color: integer;
        tol: integer;
        h, s: extended;
      end;

      TMultiColorArray: Array of TMultiColor;

    function MColor(Color, tol: integer; h, s: extended): TMultiColor;
    begin
      Result.Color := Color;
      Result.tol := tol;
      Result.h := h;
      Result.s := s;
    end;

    //to ensure correct passing of information
    function MColorArray(MArray: array of TMultiColor): TMultiColorArray;
    var
      i, L: integer;
      ThisColor: TMultiColor;
    begin
      L := Length(MArray);
      SetLength(Result, L);
     
      for i := 0 to L - 1 do
      begin
        with ThisColor do
        begin
          Color := MArray[i].Color;
          Tol := MArray[i].Tol;
          h := MArray[i].h;
          s  := MArray[i].s;
        end;

        Result[i] := ThisColor;
      end;
    end;

    type
      CTS2Mode = record
        Speed: integer;
        h, s: extended;
      end;

      var CurrentCTS, PreviousCTS, DefaultCTS: CTS2Mode;

    procedure StartCTS2Mode;
    begin
      DefaultCTS.Speed := 2;
      DefaultCTS.h := 2.00; //not sure if that's the default anymore
      DefaultCTS.s := 2.00;

      CurrentCTS.Speed := 2;
      CurrentCTS.h := 2.00;
      CurrentCTS.s := 2.00;
    end;

    Procedure Return2DefaultCTS;
    begin
      CurrentCTS.Speed := DefaultCTS.Speed;
      CurrentCTS.h := DefaultCTS.h;
      CurrentCTS.s := DefaultCTS.s;
    end;

    //Copy a CTS2Mode object
    function CopyCTS(toCopy: CTS2Mode): CTS2Mode;
    begin
      Result.Speed := toCopy.Speed;
      Result.h := toCopy.h;
      Result.s := toCopy.s;
    end;

    //allows u to create a copy of the current CTS
    function GetCurrentCTS: CTS2Mode;
    begin
      Result := CopyCTS(CurrentCTS);
    end;

    procedure mod2CTS(h, s: extended);
    begin
      PreviousCTS.Speed := CurrentCTS.Speed; // (do notice that this works here but not in java)
      PreviousCTS.h := CurrentCTS.h;
      PreviousCTS.s := CurrentCTS.s;

      CurrentCTS.h := h;
      CurrentCTS.s := s;
    end;

    procedure RecoverPreviousCTS;
    var
      NewCTS: CTS2Mode;
    begin
      NewCTS := CopyCTS(CurrentCTS);
      CurrentCTS := CopyCTS(PreviousCTS);
      PreviousCTS := CopyCTS(NewCTS);
    end;

    function Box(x1, y1, x2, y2: integer): TBox;
    begin
      Result.x1 := x1;
      Result.y1 := y1;
      Result.x2 := x2;
      Result.y2 := y2;
    end;

    function FindDoubleColor(color1, color2, tol1, tol2: integer; Area:TBox, AreaTol: integer): TPointArray;
    var
      TPA1, TPA2: TPointArray;
    begin
      FindColorsTolerance(TPA1, color1, tol1, Area.x1, Area.y1, Area.x2, Area.y2);
      FindColorsTolerance(TPA2, color2, tol2, Area.x1, Area.y1, Area.x2, Area.y2);  

      Result := MatchTPATolerance(TPA1, TPA2, AreaTol);
    end;

    function FindMultiColors(MColors: TMultiColorArray; Area: TBox; AreaTol: integer): TPointArray;
    begin

    end;

    AreaTol being how far the points can be from each other.

    The last time I think I saw MatchTPA was somewhere in MSI forums

    ~RM
    Last edited by Sir R. M8gic1an; 01-14-2011 at 11:07 PM.

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

  4. #4
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok thanks guys
    I was hopeing for an uber cool function that looked though 2 arrays and saw if there where two point so far apart.

    So wizzy pluggin(never read the tut i saw when reading on tpas) or make a black around the first color thanks for the help ( too late now tho work on it tomorrow lazy me ) or search for something called MatchTPA
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  5. #5
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Troll Man View Post
    Ok thanks guys
    I was hopeing for an uber cool function that looked though 2 arrays and saw if there where two point so far apart.

    So wizzy pluggin(never read the tut i saw when reading on tpas) or make a black around the first color thanks for the help ( too late now tho work on it tomorrow lazy me ) or search for something called MatchTPA
    You could search with 2 TPA's like RM suggested, then get the MiddleTPA of each and do if Distance(MiddleTPA1, MiddleTPA2) < DistanceYouWant then etc.

  6. #6
    Join Date
    Oct 2010
    Location
    Under a bridge
    Posts
    648
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    but with that it would bring the problem of the colors which are simlar and also very close so being able to find it in the first couple of trys is hard Which is why i was woundering is you could run two arays and see if anypoints where close without moving the mouse as the two colors as the same place should be him then it would work 1 or 2 mouse movements which would be great

    Edit: At RM's edit i think thats what im looking for and a lot simpler then what i thought thanks <3
    Last edited by Troll; 01-14-2011 at 10:41 PM.
    Quote Originally Posted by DD on IRC
    wanted to troll the troll

  7. #7
    Join Date
    Oct 2007
    Location
    #srl
    Posts
    6,102
    Mentioned
    39 Post(s)
    Quoted
    62 Post(s)

    Default

    Quote Originally Posted by Troll Man View Post
    but with that it would bring the problem of the colors which are simlar and also very close so being able to find it in the first couple of trys is hard Which is why i was woundering is you could run two arays and see if anypoints where close without moving the mouse as the two colors as the same place should be him then it would work 1 or 2 mouse movements which would be great

    Edit: At RM's edit i think thats what im looking for and a lot simpler then what i thought thanks <3
    Just sort the TPA's before checking the distance(length checks etc.)

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

    Default

    Sorry for making the edit so long already, I got carried away >.<

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

  9. #9
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Just search multiple colors using a for to do loop. After each search add the new points to the array by combining the arrays. Something like this:

    Simba Code:
    procedure FindColorsTPA(Colours : TIntegerArray);
    var
      I : Integer;
      Array1, Array2 : TpointArray;
    begin
      for i = 0 to High(Colours) do
      begin
        if FindColors(Array1,Colours[i], MSX1, MSY1, MSX2, MSY2) then
          Array2 := CombineTPA(Array1, Array2);
      end;
    end;

    Believe something like this is what your talking about.

    ~BraK

    E: You should look into FindObjThroughMM function. It's how I find the banker in the GE for my Herblore script.
    Last edited by BraK; 01-15-2011 at 01:56 AM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

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

    Default


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

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
  •