Results 1 to 4 of 4

Thread: Item Picking Up..

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

    Default Item Picking Up..

    How can I make this function better? It highlights all the items on the floor using paint.. but for whatever reason it won't click exactly where the paint is.. instead it hovers NEAR it and always at the same item instead of iterating through all ground items:

    Simba Code:
    Procedure PickUpItems(ItemList: TStringArray);
    var
      Items, TPA: TPointArray;
      Item: TPoint;
      ItemArray: Array of ItemPickup;
      I, CTS: Integer;
    begin
      LProc:= 'PickUpItems';
      SetLength(ItemArray, Length(ItemCheckList) + 1);
      For I:= 0 To High(ItemCheckList) do
        Case lowercase(ItemCheckList[I]) of
          'noted':
              begin
                ItemArray[I].Color := 8767731;     //Noted Items.
                ItemArray[I].Speed := [0.64, 1.34];
                ItemArray[I].Tolerance := 10;
              end;
          'bones', 'bone':
              begin
                ItemArray[I].Color := 13423589;     //Bones Items.
                ItemArray[I].Speed := [0.39, 2.16];
                ItemArray[I].Tolerance := 11;
              end;
          'bluecharm', 'blue charm', 'bluecharms':
              begin
                ItemArray[I].Color := 10725730;     //BlueCharm Items.
                ItemArray[I].Speed := [0.11, 0.44];
                ItemArray[I].Tolerance := 22;
              end;
          'coins', 'gold', 'gp':
              begin
                ItemArray[I].Color := 4641005;     //Coins Items.
                ItemArray[I].Speed := [0.29, 3.33];
                ItemArray[I].Tolerance := 5;
              end;
        end;

      Items:= GetMMDotsOnMS('item');
      if (Length(Items) > 0) then
      begin
        Item:= MMToMS(Items[0]);

        if ((Item.X <> 0) AND (Item.Y <> 0) AND (InvFull = False)) then
        begin
          For I:= 0 To High(ItemArray) - 1 do
          begin
            CTS:= GetColorToleranceSpeed;
            ColorToleranceSpeed(2);
            SetColorSpeed2Modifiers(ItemArray[I].Speed[0], ItemArray[I].Speed[1]);
            FindColorsTolerance(TPA, ItemArray[I].Color, MSX1, MSY1, MSX2, MSY2, ItemArray[I].Tolerance);
            DebugTPA(TPA, '');
            ColorToleranceSpeed(CTS);
            SetColorSpeed2Modifiers(0.02, 0.02);
          end;

          if (Length(TPA) < 1) then
            exit;

          Item.x:= MSCX; Item.y:= MSCY;
          SortTPAFrom(TPA, Item);
          For I:= 0 To High(TPA) do
          begin
            //MiddleTPAEx(TPA, Item.X, Item.Y);

            //MMouse(Item.X, Item.Y, 0, 0);
            MMouse(TPA[I].x, TPA[I].y, 0, 0);
            wait(200);
            if (isUptextMultiCustom(ItemList) or IsUptextMultiCustom(['ake', 'nteract', 'ttack'])) then
            begin
              ClickMouse2(False);
              WaitOptionMulti(ItemList, 300);
              wait(200);
              while isMoving do
                wait(1);
            end;
          end;
        end;
      end;
    end;
    I am Ggzz..
    Hackintosher

  2. #2
    Join Date
    Sep 2007
    Location
    Australia, NSW
    Posts
    934
    Mentioned
    6 Post(s)
    Quoted
    145 Post(s)

    Default

    Instead of using: MiddleTPAEx(TPA, Item.X, Item.Y);, maybe try:
    Simba Code:
    Item := MiddleBox(GetTPABounds(TPA));
    I think it's something like that. Instead of getting the middle of the TPA, it finds the TPA's boundaries and goes for the centre of that box.

    INACTIVE
    How-to: Make S.M.A.R.T. less laggy

    Sell me your Maple Shieldbows (u)! Up to 95gp ea!

    My Scripts:
    Ivy Chopper Ultra [RS3] | Fantastic Fletcher [RS3]
    99 x78 | 99 x10 | 99 x2 | 99 x12


    Use the REPORT tags when posting progress reports to make life easier (:
    [REPORT]Put progress report in here![/REPORT]

    Super Savvy Smither V1.06Cool Classy Cooker V1.02 [EoC]

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    I use this for my random point in an array:
    Simba Code:
    function RPDist(TPA: TPointArray; MaxDist: Integer): TPoint;
    var
      MP, P: TPoint;
    begin
      if not LoggedIn then Exit;
      P := Point(-1, -1);
      MP := MiddleTPA(TPA);
      while (DistanceTo(MP, P) > MaxDist) do
        P := TPA[Random(Length(TPA) - 1)];
      Result := P;
    end;

    It finds a point in the array that is within distance MaxDist from the center. I use it to click the rope in the stronghold of player safety because it is so small.

  4. #4
    Join Date
    Oct 2008
    Posts
    500
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It looks like you use Item just to make sure you are returning MS points at first and then again to make sure you sort the TPA from the middle of the MS before attempting to click them.

    I'm not sure if you have those lines commented out just to draw attention to them or not but if not, definitely either take those comments out or find the middle point of the TPA before calling MMouse.

    I'm trying to make sure I'm understanding your logic right, if you can answer those questions I may be able to help further.

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
  •