Results 1 to 12 of 12

Thread: TPA walking function

  1. #1
    Join Date
    Mar 2011
    Location
    Oklahoma
    Posts
    98
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default TPA walking function

    This function is an alternative to the radial walk.


    It finds colors using either a standard color and tolerance for CTS 1 or can use HSL modifiers for CTS 2. It finds all the instances of that color and clicks the closest point to the target tpoint that is within some distance defined by dist. The target tpoint is also rotated to compensate for camera rotation so the target point should be defined with a north compass angle.

    Simba Code:
    {*******************************************************************************
    function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;
    By: Kanah
    Description: Finds color based  on colorinfo ( [color,Tolerance] or [color,Tolerance,HueMod,SatMod]
                then finds the closest point to Target; if the distance between target and closest point
                is less than dist then it walks there. All this is done on the minimap
                The target point is also rotated to compensate for any deviation in compass
                angle from north so Target should be defined for a north compass angle.

      ColorInfo - [Color,Tolerance] or [color,Tolerance,HueMod,SatMod]
      Target - The approximate place to click
      Dist - the max distance from Target that would constitute a click there
    *******************************************************************************}

    function TPAWalk(ColorInfo: TExtendedArray; Target: TPoint; Dist: Integer): Boolean;
    var
      len,tmpCTS: integer;
      ColorTPA: TPointArray;
      Angle: Extended;
    begin
      CountItems
      len := length(ColorInfo);
      Result := false;
      Angle := -1*rs_GetCompassAngleRadians;
      Target := RotatePoint(Target,Angle,MMCX,MMCY);

      //Decide which option we're using
      if (len = 4) then
      begin
        //Set up the HueMod and SatMod
        tmpCTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        SetColorSpeed2Modifiers(ColorInfo[2], ColorInfo[3]);
      end else if (len <> 2) then
      begin
        writeln('Wrong length for ColorInfo');
        exit;
      end;

      //Perform the color finding
      if (FindColorsTolerance(ColorTPA,Round(ColorInfo[0]),MMX1,MMY1,MMX2,MMY2,Round(ColorInfo[1]))) then
      begin
        //Sort from the Target
        //SMART_DrawDots(ColorTPA);
        SortTPAFrom(ColorTPA,Target);

        //Check the distance
        if (Distance(ColorTPA[0].x,ColorTPA[0].y,Target.x,Target.y)<dist) then
        begin
          //Now lets walk there
          Mouse(ColorTPA[0].x,ColorTPA[0].y,2,2,true);
          FFlag(5);
          wait(random(300));
          Result := true;
        end else
          writeln('Color not found in correct location on Minimap');
      end else
        writeln('Failed to find color on minimap');

      if (len = 4) then
      begin
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
      end;
    end;
    ---- Kanah ----

    “If God did not exist then surely man would create him" - Voltiare

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

    Default

    Just to point out this has been used with a fair amount of success (the method not this particular function)

    -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
    Mar 2011
    Location
    Oklahoma
    Posts
    98
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Sir R. M8gic1an View Post
    Just to point out this has been used with a fair amount of success (the method not this particular function)

    -RM
    cool

    Interesting that no one has tried added this to the SRL library before.
    ---- Kanah ----

    “If God did not exist then surely man would create him" - Voltiare

  4. #4
    Join Date
    Aug 2007
    Location
    Colorado
    Posts
    7,421
    Mentioned
    268 Post(s)
    Quoted
    1442 Post(s)

    Default

    Kinda the same concept as Camero's walking method, but this has the ability to use CTS2, yes?

    Current projects:
    [ AeroGuardians (GotR minigame), Motherlode Miner, Blast furnace ]

    "I won't fall in your gravity. Open your eyes,
    you're the Earth and I'm the sky..."


  5. #5
    Join Date
    Mar 2011
    Location
    Oklahoma
    Posts
    98
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This has the option of using the CTS2 or CTS1

    And yes this is the same concept as camero's walking method.
    ---- Kanah ----

    “If God did not exist then surely man would create him" - Voltiare

  6. #6
    Join Date
    Mar 2008
    Location
    Look behind you.
    Posts
    795
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    A scripter can add this to their own scripts, but I feel that SRL needs a function like this. It works like RadialWalk, but is far more accurate to where it clicks.

  7. #7
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    This is just like simple TPA walking, I don't think it should be added to the repos because it is one less thing that doesn't show skill or real knowledge.

    -Boom

  8. #8
    Join Date
    Mar 2011
    Location
    Oklahoma
    Posts
    98
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Dynamite View Post
    This is just like simple TPA walking, I don't think it should be added to the repos because it is one less thing that doesn't show skill or real knowledge.

    -Boom
    The point of adding something to the SRL library is not to demonstrate skill or anything, it is to provide functions that are used in every script. It makes no sense for everyone to just recreate this function in each of their scripts. The include is so that basic functions like this dont have to be copy-pasted every time they are needed but are by default already in the repo ready for you.
    ---- Kanah ----

    “If God did not exist then surely man would create him" - Voltiare

  9. #9
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    I actually wouldn't mind this being added. Would definitely be very convenient. I don't think it's any different from radial walking (whether it should in in the include or not).

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

    Default

    Quote Originally Posted by Coh3n View Post
    I don't think it's any different from radial walking (whether it should in in the include or not).
    Which is exactly why I don't think it needs to be added. SRL already provides a walking method that works perfectly fine. Plus the FindObj* functions in Object.simba can be used the same way as this if specified to search the MM. Nice to see you back Coh3n.

    Not that there is anything wrong with the function, kanah.
    Last edited by NCDS; 12-31-2011 at 04:00 AM.

  11. #11
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by NCDS View Post
    Which is exactly why I don't think it needs to be added. SRL already provides a walking method that works perfectly fine. Plus the FindObj* functions in Object.simba can be used the same way as this if specified to search the MM. Nice to see you back Coh3n.

    Not that there is anything wrong with the function, kanah.
    In my experience, this method works better than radial walking (assuming it's the same as Camaro's). Perhaps this is better in the snippets section.

    I don't mind either way.

    E: I think it should be added, but I'll wait. I suggest adding "offset" parameters so that if you want to find a rock on the MM, but want to click a little north of it, you can.

  12. #12
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Added a simpler function in the latest version. If scripters want to use CTS2 they can set it before calling TPAWalk (added to mapwalk.simba).

    http://villavu.com/forum/showthread....690#post886690

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
  •