Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: Help with TPAs

  1. #1
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default Help with TPAs

    So I found a tutorial on a more accurate way to target mobs and I decided to use TPAs to make a cow killing script. The script worked a few hours ago on a different computer, but now it is not working on the one I am using now, with the computers having the same specs and everything (Windows 7 64 bit etc.) The problem I am having with it is its not finding the cow to click on it. I tried picking new colors and tolerances for about 15 minutes to see if it would work but that was to no avail. Could someone take a look at it and tell me if there are any obvious errors?

    Simba Code:
    Function KillCows: Boolean;

    Var

       TPAA: T2DPointArray;
       TPA: TPointArray;
       CTS, x, y, I, Retry: Integer;
    Begin
      CTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      case Random(3) of  // this is for the different color cows
      0:
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 3822686, MSX1, MSY1, MSX2, MSY2, 15); // I tried changing all of the MSs here to 0, 0, 750, 450
      1:
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 5726322, MSX1, MSY1, MSX2, MSY2, 15);
      2:
        FindColorsSpiralTolerance(MSCX, MSCY, TPA, 8229540, MSX1, MSY1, MSX2, MSY2, 15);
      end;
      ColorToleranceSpeed(CTS);
      TPAA := TPAToATPAEx(TPA, 3, 3); // I also messed with the width and height
      SortATPASize(TPAA, True);
      For I := 0 To High(TPAA) do
        if GetArraylength(TPAA[i]) > 4 then // changed this several times
        begin
        repeat
          inc(Retry);
          MiddleTPAEx(TPAA[i], x, y);
          MMouse(x, y, 3, 3);
           if (IsMouseOverText('tta')) then
          begin
            Result := true;
            GetMousePos(X, Y);
            mouse(x,y,2,3, true);
            wait(3500 + Random(1000));
            Break;
          end;
          until (Retry = 2);
          Break;
          end;
          end;

  2. #2
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Try autocoloring it mate, much more accurate.

    Click here for video tutorial.

    Creds to DannyRS for this wonderful sig!

  3. #3
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    Using ACA is very helpful for Beginners and I would recommend it for accurately picking the cow colors you need (perhaps using a CTS of 2, for more accurate results too in ACA)

    There's also many guides in the Intermediate Section and the Advanced Section that explain TPA's too

    Also, you can find help often at #SRL in rizon server/network on IRC.

    Cheers
    Lj

  4. #4
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    For some reason I narrowed it down to simba (on this new computer, not the one I wrote the script on) isn't finding the colors right for me. I have my settings exactly the same as before and am playing in the same browser and everything. For example, I used the color picker to get the color of the top of a bankbox and tested if simba could even find that color AT ALL, and it couldn't find it anywhere on the screen. I also had the right client selected. I didn't log out in between so the color didn't change. I even double checked the color to be sure it was the same number. I have re-installed simba several times and it is still doing the same thing.

    Simba Code:
    program new;
    //{$DEFINE SMART}
    {$I SRL/SRL.simba}
    {$i sps/sps.simba}

    procedure findthecolor;
    var
      x, y: Integer;
    begin
      if FindColorTolerance(x, y, 8881020, 0, 0, 750, 450, 3) then
        begin
        Mouse(x, y, 3, 3, True);
        WriteLn('found it');
      end;
    end;
    begin
    SetupSRl;
    dothecolor;
    end.

    I ran this several times and at 0 tolerance it didn't find the color (when it should have... it was right there in front of it.), but at around 10 or 15 it started clicking colors similar to the top of the bankbox, but not the one I specified.
    Last edited by Foundry; 07-30-2013 at 09:38 PM. Reason: Added more info

  5. #5
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    For some reason I narrowed it down to simba (on this new computer, not the one I wrote the script on) isn't finding the colors right for me. I have my settings exactly the same as before and am playing in the same browser and everything. For example, I used the color picker to get the color of the top of a bankbox and tested if simba could even find that color AT ALL, and it couldn't find it anywhere on the screen. I also had the right client selected. I didn't log out in between so the color didn't change. I even double checked the color to be sure it was the same number. I have re-installed simba several times and it is still doing the same thing.

    Simba Code:
    program new;
    //{$DEFINE SMART}
    {$I SRL/SRL.simba}
    {$i sps/sps.simba}

    procedure findthecolor;
    var
      x, y: Integer;
    begin
      if FindColorTolerance(x, y, 8881020, 0, 0, 750, 450, 3) then
        begin
        Mouse(x, y, 3, 3, True);
        WriteLn('found it');
      end;
    end;
    begin
    SetupSRl;
    dothecolor;
    end.

    I ran this several times and at 0 tolerance it didn't find the color (when it should have... it was right there in front of it.), but at around 10 or 15 it started clicking colors similar to the top of the bankbox, but not the one I specified.
    Give the tutorial I linked a go bud. U won't regret it

    Creds to DannyRS for this wonderful sig!

  6. #6
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.

  7. #7
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.
    in your mainloop it says dothecolor; while the procedure's name should be findthecolor;

    Is that one of the reasons?

    Creds to DannyRS for this wonderful sig!

  8. #8
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    Thank you for the link, and I have already tried autocoloring to find npcs, and it works quite well. I guess I should post my problem in a different section, as I have figured out it doesn't have anything to do with the script apparently. My install of Simba is not identifying colors correctly.
    Could you run this:

    Simba Code:
    program new;

    var
      w, h: Integer;
      bmp: Integer;
    begin
      GetClientDimensions(w, h);

      bmp := BitmapFromClient(0, 0, w - 1, h - 1);

      ClearDebugImg();
      DisplayDebugImgWindow(w, h);
      DrawBitmapDebugImg(bmp);
    end.

    Wrote it in browser but should work.
    Working on: Tithe Farmer

  9. #9
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    I changed that when I was making the post, my bad. It is the same in the script.

    Yes, that runs and everything and brings up a black window that eternally says loading.

    EDIT: I was loading the game a few seconds before I ran that
    EDIT 2: yeah whenever I run it it shows what was in that window prior to when I switched to the client
    Last edited by Foundry; 07-30-2013 at 10:18 PM.

  10. #10
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    I changed that when I was making the post, my bad. It is the same in the script.

    Yes, that runs and everything and brings up a black window that eternally says loading.

    EDIT: I was loading the game a few seconds before I ran that
    I wanted to know if the screen that pops up looks similar to whatever the client or target is at that moment.

    e:
    EDIT 2: yeah whenever I run it it shows what was in that window prior to when I switched to the client
    Then your color recognition works fine
    Last edited by masterBB; 07-30-2013 at 10:20 PM.
    Working on: Tithe Farmer

  11. #11
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    I wanted to know if the screen that pops up looks similar to whatever the client or target is at that moment.
    It does not look at all similar

  12. #12
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    It does not look at all similar
    Hmmm, well that is odd. That code gets whatever is the target as a bitmap. Are the colors different, the image itself, is black? What are you seeing?
    Working on: Tithe Farmer

  13. #13
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    I can help u with the TPA's thru teamviewer if u want?

    Creds to DannyRS for this wonderful sig!

  14. #14
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Is it ok if I upload a screenshot or a link to one?

  15. #15
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    Is it ok if I upload a screenshot or a link to one?
    go for it

    Creds to DannyRS for this wonderful sig!

  16. #16
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

  17. #17
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Do you see this green crosshair in simba?

    DRAG that on the runescape client so that only your runescape client is covered in red
    Then start the script.

    Creds to DannyRS for this wonderful sig!

  18. #18
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    I did that many times over

  19. #19
    Join Date
    Mar 2006
    Location
    Belgium
    Posts
    3,564
    Mentioned
    111 Post(s)
    Quoted
    1475 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    I did that many times over
    Well that's weird

    @masterBB helps

    Creds to DannyRS for this wonderful sig!

  20. #20
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by Sjoe View Post
    Well that's weird

    @masterBB helps
    NANANANANANANANANA Bartman! To the rescue!

    uhm, Are you sure openGL or directX mode aren't turned on by any change?
    Working on: Tithe Farmer

  21. #21
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    In the graphics settings, OpenGL is selected. But doesn't one or the other have to be chosen?

  22. #22
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Quote Originally Posted by HardcorBoter View Post
    In the graphics settings, OpenGL is selected. But doesn't one or the other have to be chosen?
    Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.
    Working on: Tithe Farmer

  23. #23
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.
    So, do I have to use SMART, or do I just need to update it?

  24. #24
    Join Date
    Feb 2012
    Location
    Discord
    Posts
    3,114
    Mentioned
    37 Post(s)
    Quoted
    538 Post(s)

    Default

    Quote Originally Posted by masterBB View Post
    Well, there is your problem! There used to be some software mode. We can actually read openGL thanks to Brandon. But you need that plugin and the latest version of SMART. Or else you need to use software mode/safe mode.
    Software mode got removed :/ I don't know the current status on safety mode but I think it still works.

  25. #25
    Join Date
    Jul 2013
    Location
    An horse
    Posts
    300
    Mentioned
    9 Post(s)
    Quoted
    120 Post(s)

    Default

    I tried switching to DirectX and it works. Thanks everyone and sorry for the trouble!

Page 1 of 2 12 LastLast

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
  •