Results 1 to 6 of 6

Thread: How to prioritize which loot to pick up?

  1. #1
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default How to prioritize which loot to pick up?

    Im trying to choose which loot to pick up first, when both are the same color so i use the same TPA for both. Im choosing which loots based of the uptext and choose option.

    I tried using this:
    Simba Code:
    (*
    ChooseOptionMulti
    ~~~~~~~~~~~~~~~~~

    .. code-block:: pascal

        function ChooseOptionMulti(Txt: TStringArray): Boolean;

    Finds Popup menu, then clicks on it. Will look for the first string first and so on.

    .. note::

        by Wizzup? & N1ke!

    Example:

    .. code-block:: pascal

    *)

    function ChooseOptionMulti(Txt: TStringArray): Boolean;
    begin
      Result := ChooseOptionMultiEx(Txt, 'All', ClickLeft);
    end;]

    Even though it says it picks the first string first, thats not the case. it just loots the which ever item is on the top of the loot pile with a matching uptext.

    Any functions that would pick whichever uptext first that i choose?

    Example:

    Im trying to loot cowhides first, then raw beef second if no cowhides are there, but since raw beef appears ontop of cowhide in the loot pile, it chooses the beef.

    ChooseOptionMulti(['owhide','aw beef']);

    Doesnt work even though i list cowhide first :/

  2. #2
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    You'd want to have a loop that calls ChooseOption, passing the next loot each time.

    Simba Code:
    Loots := ['owhide', 'aw beef', 'ones']; // Loots is a TStringArray, and I added 'ones' (bones) just to make it clear, hopefully, what's happening.
    for i := 0 to High(Loots) do
    begin
      Mouse(x, y, 0, 0, False); // Right click where the mouse is to get the ChooseOption menu opened.
      ChooseOption(Loots[i]); // Choose each option, in order, according to Loots (defined above).
    end;

    This will do what you've asked.

  3. #3
    Join Date
    Jan 2012
    Posts
    1,104
    Mentioned
    18 Post(s)
    Quoted
    211 Post(s)

    Default

    Quote Originally Posted by i luffs yeww View Post
    You'd want to have a loop that calls ChooseOption, passing the next loot each time.

    Simba Code:
    Loots := ['owhide', 'aw beef', 'ones']; // Loots is a TStringArray, and I added 'ones' (bones) just to make it clear, hopefully, what's happening.
    for i := 0 to High(Loots) do
    begin
      Mouse(x, y, 0, 0, False); // Right click where the mouse is to get the ChooseOption menu opened.
      ChooseOption(Loots[i]); // Choose each option, in order, according to Loots (defined above).
    end;

    This will do what you've asked.
    This is not a good solution. If it cant find 'owhide', it will move the mouse away, right click again on the spot, look for 'aw beef' ...

    You should do something like this:
    Simba Code:
    procedure Loot(X,Y : Integer);
    var
      i, j : Integer;
      Box : TBox;
      Loots : Array of String;
      Options : Array of TOptions;
    begin
      Loots := ['owhide', 'aw beef', 'ones'];
      Mouse(X,Y,0,0,mouse_right);
      Options := GetChooseOptions('action');
      for i := 0 to High(Loots) do
        for j := 0 to High(Options) do
        begin
          if Pos('Take ' + Loots[i],Options[j].Str) > 0 Then
          begin
            Box := Options[j].Bounds;
            GetMousePos(X,Y);
            if PointInBox(Point(X,Y),Box) then
              ClickMouse2(mouse_left)
            else
              MouseBox(Box.x1,Box.y1,Box.x2,Box.y2,5,mouse_left);
          end;
        end;
    end;

  4. #4
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    Quote Originally Posted by Shatterhand View Post
    This is not a good solution. If it cant find 'owhide', it will move the mouse away, right click again on the spot, look for 'aw beef' ...

    You should do something like this:
    Simba Code:
    procedure Loot(X,Y : Integer);
    var
      i, j : Integer;
      Box : TBox;
      Loots : Array of String;
      Options : Array of TOptions;
    begin
      Loots := ['owhide', 'aw beef', 'ones'];
      Mouse(X,Y,0,0,mouse_right);
      Options := GetChooseOptions('action');
      for i := 0 to High(Loots) do
        for j := 0 to High(Options) do
        begin
          if Pos('Take ' + Loots[i],Options[j].Str) > 0 Then
          begin
            Box := Options[j].Bounds;
            GetMousePos(X,Y);
            if PointInBox(Point(X,Y),Box) then
              ClickMouse2(mouse_left)
            else
              MouseBox(Box.x1,Box.y1,Box.x2,Box.y2,5,mouse_left);
          end;
        end;
    end;
    You're correct. I was just trying to get him on the right path with the loop, and let him do the rest. But now you've done it for him and my whole post was a waste!

  5. #5
    Join Date
    Nov 2011
    Location
    United States
    Posts
    815
    Mentioned
    6 Post(s)
    Quoted
    284 Post(s)

    Default

    Quote Originally Posted by Shatterhand View Post
    This is not a good solution. If it cant find 'owhide', it will move the mouse away, right click again on the spot, look for 'aw beef' ...

    You should do something like this:
    Simba Code:
    procedure Loot(X,Y : Integer);
    var
      i, j : Integer;
      Box : TBox;
      Loots : Array of String;
      Options : Array of TOptions;
    begin
      Loots := ['owhide', 'aw beef', 'ones'];
      Mouse(X,Y,0,0,mouse_right);
      Options := GetChooseOptions('action');
      for i := 0 to High(Loots) do
        for j := 0 to High(Options) do
        begin
          if Pos('Take ' + Loots[i],Options[j].Str) > 0 Then
          begin
            Box := Options[j].Bounds;
            GetMousePos(X,Y);
            if PointInBox(Point(X,Y),Box) then
              ClickMouse2(mouse_left)
            else
              MouseBox(Box.x1,Box.y1,Box.x2,Box.y2,5,mouse_left);
          end;
        end;
    end;
    I seem to get invalid number of parameters on the MouseBox Line when trying to use that.
    Idk whats causing it.

    Thank you both for the help. Still trying to learn all this stuff lol

  6. #6
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Remove the '5' in the MouseBox arguments.
    Simba Code:
    MouseBox(Box.x1, Box.y1, Box.x2, Box.y2, mouse_left);

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
  •