Results 1 to 5 of 5

Thread: Removing points

  1. #1
    Join Date
    Jun 2007
    Posts
    532
    Mentioned
    1 Post(s)
    Quoted
    68 Post(s)

    Default Removing points

    I am trying to make a combat looting procedure. This is what I have so far...

    Simba Code:
    function Loot: Boolean;
    var
      CTS: Integer;
      TPA, Player_TPA: TPointArray;
      ATPA: array of TPointArray;
    begin
      if (not (LoggedIn)) then
        Exit;
      Player_TPA := TPAFromBox(IntToBox(245, 130, 285, 195));
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.40, 3.26);
      if FindColorsSpiralTolerance(MSCX, MSCY, TPA, 13949677, MSX1, MSY1, MSX2, MSY2, 10) then
      begin
        TPA := ClearTPAFromTPA(TPA, Player_TPA);
        ColorToleranceSpeed(CTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        RAaSTPA(TPA, 5);
        ATPA := SplitTPAEx(TPA, 10, 10);
        SortATPAFromFirstPoint(ATPA, Point(MSCX, MSCY));
        DeBugATPABounds(ATPA);
        for i := 0 to High(ATPA) do
        begin
          MiddleTPAEx(ATPA[i], x, y);
          HumanMMouse(x, y, 5, 5);
          Writeln(GetUpText);
          if WaitUpText('Take', 400) then
          begin
            Writeln('UpText match');
            ClickMouse2(False);
            if ChooseOption('charm') then
            Result := True;
            Exit;
          end
          else
          begin
            writeln('No charm');
            Exit;
          end;
        end;
      end;
    end;

    The function searches for the bone color and if it finds the bone color it right clicks and searches for option charm.
    This works, but after it takes the charm I search again to look for another pile but it searches the same pile. Should I remove that point from the TPA once its been searched or what? This is my first combat script and first try at looting.
    Finished B.S. Program in Radiology!!

    Projects: A big one! Total secret! hehe

  2. #2
    Join Date
    Dec 2011
    Location
    Toronto, Ontario
    Posts
    6,424
    Mentioned
    84 Post(s)
    Quoted
    863 Post(s)

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    No.. I usually don't disagree with you Sin, but on this I do. Lol.

    Here's why. If the TPA is a local TPA. Meaning a local variable (scope is within a function), then there is no need to remove any points (unless you left the bone there -_-). And the reason is because you can simply just call the function again. On the second call, the Local TPA would have already been wiped before the first call even returns from the stack.

    Removing points from the TPA may actually be slower than just letting the interpret clean it natively and simply making another function call. Why? Because you might have to search for the point/iterate the array. Then do the removal and removing requires a copy of the array without the old point there unless it's a linked list or other container type (none of which we have in Simba).

    It'd be wise to probably do a speed test or efficiency test then but my guess is that there is no need for looting since you can simply just call the function again and save yourself the work (unless you want to).
    Last edited by Brandon; 06-26-2013 at 04:07 AM.
    I am Ggzz..
    Hackintosher

  4. #4
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by Element17 View Post
    The function searches for the bone color and if it finds the bone color it right clicks and searches for option charm.
    This works, but after it takes the charm I search again to look for another pile but it searches the same pile. Should I remove that point from the TPA once its been searched or what? This is my first combat script and first try at looting.
    Because you are looking for the bone to find a loot pile, I would recommend picking up the bone and burying it after you have found the pile. This will mean that next time you look for a pile, the looted pile will not appear

  5. #5
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    Well if your player is moving spot-to-spot, wouldn't you not even be able to remove the already searched pile, since its mainscreen position changed when your player moved?

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
  •