Results 1 to 12 of 12

Thread: Preventing reclicking from TPA's

  1. #1
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default Preventing reclicking from TPA's

    Alright, how do you make it delete the points where it fails/clicked already, so it won't click there again.
    Here's the code.

    EDIT:No idea if I got it or not...
    Simba Code:
    function Create(var x,y:Integer):Boolean;
    var
      i,a,Herbs:Integer;
      TPA:TPointArray;
      ATPA:T2DPointArray;
      MP:TPoint;
      Box:TBox;
    begin
      if(Act = 'Clean') then
      begin
        Herbs := DTMFromString('mggAAAHicY2NgYFBnZGCQAWIRKG0IxKpAnAnE2UCcDMSJUDoaiO2NpIG6mLBg7IARB4YAAGfrA84=');
        MouseSpeed := 50
        Repeat
          FindDTMS(Herbs,TPA,MIX1,MIY1,MIX2,MIY2);
          SortTPAFrom(TPA,Point(MICX,MICY));
         ATPA := TPAtoATPAEx(TPA, 15, 15);

          for a:= 0 to High(ATPA) do
          begin
            MP := MiddleTPA(ATPA[a]);
            Box := IntToBox((MP.x - 20),(MP.y - 20), (MP.x + 20),(MP.y + 20));
            SMART_DrawBoxEx(True,Box,clYellow);
            MMouse(MP.x,MP.y,4,4);
            if(WaitUpText('imy',100))then
            begin
               x := MP.X; y := MP.Y;
              Result := True;
              Mouse(x,y,3,3,True);
              SMART_ClearCanvas;
              Break;
            end;
          end;
        Until not(FindDTM(Herbs,x,y,MIX1,MIY1,MIX2,MIY2))
        FreeDTM(Herbs);
      end;
    end;

    I want it to click all the grimy herbs, but it clicks the Clean herbs also.
    Last edited by NKN; 04-21-2012 at 12:42 AM.

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Maybe you should just use the Herbs DTM? That way it won't ever click the clean ones unless your DTM is crap.

  3. #3
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    It takes a second for the herbs to change though, so it'll click them again, slowing the script down.

  4. #4
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    It takes a second for the herbs to change though, so it'll click them again, slowing the script down.
    Add a Wait(100 + Random(60)); before searching again?

  5. #5
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    It would be faster though. :|

  6. #6
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Quote Originally Posted by NKN View Post
    It would be faster though. :|
    Faster vs Safer

    That is the question...

  7. #7
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    I think I found it.

    Tell me if this -could- work.

    If I stored the last clicked point into a Tpoint, then used:
    NearbyPointInArray to check, and if it was, just had it continue?

  8. #8
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Simba Code:
    for i := 0 to 27 do
    begin
      b := InvBox(i + 1);
      if FindDTM(x, y, HerbDTM, b.x1, b.y1, b.x2, b.y2) then
      begin
        Mouse(x, y, 4, 4, mouse_Left);
        Wait(200 + random(100));
      end;
    end;
    Try that?
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

  9. #9
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Still about as fast as InvMouse

  10. #10
    Join Date
    Oct 2009
    Location
    Stockton, CA
    Posts
    2,040
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Remove the wait and change the MouseSpeed. If you want it faster, just get the center pixel of every inventory slot and see if it is similar to the color of the unclean herb. If it is, click and continue.
    Join the IRC! irc.rizon.net:6667/srl | SQLite (0.99rc3+) | SRL Doc | Simba Doc | Extra Simba Libraries (openSSL & sqlite3)
    Quote Originally Posted by #srl
    10:45 < Toter> daphil when can get sex anyday I want
    10:45 < Toter> he is always on #SRL
    "A programmer is just a tool which converts caffeine into code"

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

    Default

    Simba Code:
    DeleteValueInTPA        // Deletes a value in a tpa at the specified position which requires that you loop through the TPA.
    ItemActivated            // Will tell you if an item is clicked or activated.. All items when clicked with the use option will have a white outline.
    DidClick            //Check for a red or yellow click

    all functions you may find quite useful..

    The below will remove all OR one of a point from a TPA and return the removed TPA.. If nothing was removed, it will return the original TPA.
    Simba Code:
    Function RemovePointsFromTPA(TPA: TPointArray; Point: TPoint; DeleteAll: Boolean): TPointArray;
    var
      I, L: Integer;
    begin
      L:= High(TPA);

      For I:= 0 To L do
        if (TPA[I] = Point) then
        begin
          DeleteValueInTPA(TPA, I);
          if (Not DeleteAll) then
            break;
        end;
      Result:= TPA;
    end;


    This function will give you a record of all the slots the TPA is in.. Unique slots that is.
    Simba Code:
    Function TPAToSlots(TPA: TPointArray): TIntegerArray;
    var
      I, L: Integer;
    begin
      L:= High(TPA);
      SetLength(Result, L + 1);

      For I:= 0 To L do
        Result[I]:= CoordsToItem(TPA[I].X, TPA[I].Y);

      ClearSameIntegers(Result);
    end;

    Get your TPA of items, Pass it to this function, it will return all slots that contain the TPA points.. Iterate through each slot clicking each item once.. After Clicking a slot, Remove that slot from the ArrayOfSlots.. Simple.
    I am Ggzz..
    Hackintosher

  12. #12
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    3,383
    Mentioned
    95 Post(s)
    Quoted
    717 Post(s)

    Default

    Edit:
    No idea how to use any of those, and now it's lagging epicly, then stops. -nod-
    Last edited by NKN; 04-20-2012 at 10:24 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
  •