Results 1 to 12 of 12

Thread: Tpa

  1. #1
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default Tpa

    ok so ive been reading sum tutorials amd they all are way over my head can someone make a tpa to cut a normal tree and and explain what u did


    ty

  2. #2
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Hi! No problem!

    SCAR Code:
    procedure CutTree;
    var
      I, H, x, y: Integer; // Declare integers that will be used
      CTS: Integer; // Record the current CTS so we can replace it once done
      TPA: TPointArray; // Store TPoints into an array for shortness
      ATPA: T2DPointArray; //Store a 2 dimensional array of TPA.
    begin
      CTS := GetColorToleranceSpeed; // Save the current CTS into CTS
      ColorToleranceSpeed(2); // Set our new CTS 1=fast, 2=medium,accurate, 3=slow,REAL accurate
      SetColorSpeed2Modifiers(0.2, 0.2); // Set our SAT and HSL values, default is 0.2 & 0.2

      FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3); // Find the colors and store them into TPA as multiple TPoints. (4754045=tree color, 'ms...'= the x1,y1,x2,y2 values, 3=tolerance)

      if (Length(TPA) = 0) then Exit; // If there are no TPA points found, then exit proc.

      ATPA := SplitTPAEx(TPA, 9, 9); // Create the T2DPointArray, (TPA=the 1d point values, 9,9= the distances between TPA's to put together as one)

      SortATPAFrom(ATPA, Point(MSCX, MSCY)); // Sort all the ATPA's from the center of the main screen.

      H := High(ATPA) - 1; // Get the length of how many ATPA's are stored, and subtract 1 so it doesn't count the extra value wasteful value at the last of the array.

      for I := 0 to H do // Make the loop to go through all points in the ATPA.
      begin
         MiddleTPAEx(ATPA[I], x, y); // Get the center point between the set of two ATPA Points, and store them into x & y.

         MMouse(x, y, 3, 3); // Moves mouse to the x & y location recorded with 3 as random value to add to each x and y.
         
         Wait(100 + Random(200)); // Waits a few random milliseconds until the mouse has reached the object

         if IsUpText('ree') then // check if the uptext of current mouse pos to see if its a tree
         begin
           Mouse(x, y, 3, 3, True); // Click the mouse on the x, y pos recorded. (True=Left click)
           
           Wait(1000 + Random(1000)); // Wait 1000ms with random 1000ms until tree is cut down
         end;
      end;
    end;


    There you go! If you need more help lemme know!



    ~NS
    Last edited by Nadeem; 05-13-2009 at 10:39 AM.

  3. #3
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    if not FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3) then
      exit;
    >
    SCAR Code:
    FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3); // Find the colors and store them into TPA as multiple TPoints. ('ree'=tree name, 'ms...'= the x1,y1,x2,y2 values, 3=tolerance)

      if (Length(TPA) = 0) then Exit; // If there are no TPA points found, then exit proc.

  4. #4
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol w.e :P I just typed that out right now for the sake of helping, so correct/edit all you want nub!



    ~NS

  5. #5
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default

    ok so from what i understand abput tpas is that

    Code:
    FindColorsTolerance(TPA, 'ree', MSX1, MSY1, MSX2, MSY2, 3);
    'ree' should be a color doe is sumhow kow what color the tree is or do i pick the color my self

  6. #6
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oh LOL my bad (First post edited as well!)

    Here:

    SCAR Code:
    FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3);



    ~NS

  7. #7
    Join Date
    Feb 2007
    Location
    South East England
    Posts
    2,906
    Mentioned
    2 Post(s)
    Quoted
    8 Post(s)

    Default

    SCAR Code:
    function YourTPA: Boolean;
    var
      CTS, i: Integer; //Your integers
      TPA: TPointArray; //Your TPoint
      ATPA: Array of TPointArray; //It is all of the TPA's together
    begin
      CTS := GetColorToleranceSpeed; //Saves your current Speed as CTS
      ColorToleranceSpeed(2); //Puts the CTS to 2, for use in the procedure
      SetColorSpeed2Modifiers(HueMod, SatMod); //HueMod and SatMod are replaced by the modifications on the colour which you are using, and can be defined with the script at the bottom of this example
      FindColorsSpiralTolerance(MSCX, MSCY, TPA, MidColour, MSX1, MSY1, MSX2, MSY2, 10); //This finds the thing that you want to find. MidColour is the colour defined by the script at the bottom of this example.
      SetColorSpeed2Modifiers(0.2, 0.2); //Chaned the Color speed modifiers back.
      ColorToleranceSpeed(CTS); //Puts the colours back to default.
      ATPA := TPAToATPAEx(TPA, 15, 15); //This makes an ATPA of all of the points in the 15 by 15 box of the TPA which we defined earlier in FindColorsSpiralTolerance.
      for i := 0 to High(ATPA) do //This does from 0 to all of our TPA's in ATPA it will
       begin
        MiddleTPAEx(ATPA[i], x, y);//Find the centre point of our ATPA's and saves then under x and y
        MMouse(x, y, 2, 2); //This moves the mouse to the x and y points defined in MiddleTPAEx.
        begin
          DoYourShit //Then you can make it do what you want it too.
        end;
      end;
    end;

    Use this to work out your variables..

    SCAR Code:
    program FindTPAVariables;
    {.include SRL/SRL.scar}

    var
      H, S, L, HueMod, SatMod: Extended;
      MidColour, i, ii: integer;
      HueString, SatString: string;
      HSLColor: Array[1..3] of Extended;
      HSL: Array[0..1] of Array[1..3] of Extended;
      Colors: TIntegerArray;

    begin
      Colors := [3241318, 2645844, 2119755, 2645844];     // PUT YOUR COLOURS HERE PL0X
      for i := 0 to High(Colors) do
      begin
        ColortoHSL(Colors[i], HSLColor[1], HSLColor[2], HSLColor[3]);
        for ii:= 1 to 3 do
        begin
          HSL[0][ii] := MinE(HSLColor[ii], HSL[0][ii]);
          HSL[1][ii] := MaxE(HSLColor[ii], HSL[1][ii]);
        end;
      end;
      H := HSL[1][1] - HSL[0][1];
      S := HSL[1][2] - HSL[0][2];
      L := HSL[1][3] - HSL[0][3];
      MidColour := HSLToColor((HSL[1][1] + HSL[0][1]) div 2,(HSL[1][2] + HSL[0][2]) div 2,(HSL[1][3] + HSL[0][3]) div 2);
      HueMod := (H/L);
      SatMod := (S/L);
      HueString := FloatToStr(HueMod);
      SatString := FloatToStr(SatMod);
      SetLength(HueString, 4);
      SetLength(SatString, 4);
      ClearDebug;
      Writeln('Hue Mod '+ HueString +'');
      Writeln('Sat Mod '+ SatString +'');
      Writeln('MidColour ' +  IntToStr(MidColour)  +'');
    end.
    Jus' Lurkin'

  8. #8
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    Don't worry I never got TPA's in the beginning

    I just used the same template and played with them for along time, if your younger (on average) it will take longer to learn it .

    Btw.
    http://www.villavu.com/forum/showthr...ht=how+to+make

    Some of it is wrong because I made it a year ago and still haden't grasped the full concept
    Last edited by Naum; 05-13-2009 at 11:17 PM.

  9. #9
    Join Date
    Nov 2015
    Location
    Oregon
    Posts
    51
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    What is MSX1 and all that it doesnt identify ant of it
    My Scripts:
    TizenX Damage Token Collector
    OS-Scape Auto Buyer
    Check out an index of all my scripts here: ScriptingSRL

  10. #10
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    MSX1 stands for the top left corner of the main screen.
    No clue what you mean by second part though
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  11. #11
    Join Date
    Jan 2013
    Posts
    86
    Mentioned
    0 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by Starfox View Post
    What is MSX1 and all that it doesnt identify ant of it
    Code:
    FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3);
    Using this as an example ^

    MSX1 = Top left X coordinate, MSY1 = Top left Y coordinate, MSX2 = Bottom right X coordinate, MSY2 = Bottom right Y coordinate, 3 = tolerance.

    So if the top left of my client is X=470, Y=290 and the bottom right is X=1225, Y=785 it would be;

    Code:
    FindColorsTolerance(TPA, 4754045, 470, 290, 1225, 785, 3);

  12. #12
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by deejaay View Post
    Code:
    FindColorsTolerance(TPA, 4754045, MSX1, MSY1, MSX2, MSY2, 3);
    Using this as an example ^

    MSX1 = Top left X coordinate, MSY1 = Top left Y coordinate, MSX2 = Bottom right X coordinate, MSY2 = Bottom right Y coordinate, 3 = tolerance.

    So if the top left of my client is X=470, Y=290 and the bottom right is X=1225, Y=785 it would be;

    Code:
    FindColorsTolerance(TPA, 4754045, 470, 290, 1225, 785, 3);
    Ehh, not really. MSX1..MSY2 are constants specific to the Runescape main screen (e.g. Reflection or Aerolib).
    The top left of your client will almost always be (0,0). If you're using setDesktopAsClient() for whatever reason, then there are easy ways of getting the position and dimensions.

    ^^^Also gj bumping 2766 day old thread
    Last edited by Citrus; 12-08-2016 at 06:44 PM.

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
  •