Results 1 to 6 of 6

Thread: Better object finding

  1. #1
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default Better object finding

    Hello fellow scripters,

    I'm currently in the process of improving my Swamp Toad collector script.

    One major flaw in my script is the locating/clicking of toads on the ground.



    As you can see, the toads are extremely small and similar in colour to the grass around. At the moment I'm using FindObjCustom to locate them. It does find them eventually, but is extremely bot-like, chunky and slow.

    Have any of you got suggestions on a better function to use? I'm just a beginner and would love it if you could explain how.

    Cheers

  2. #2
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default

    Hey I'm only F2P can you either upload a picture of better quality, (in the picture please have 1 item in your inventory) or, let me borrow the account for a second please?

  3. #3
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post
    Hey I'm only F2P can you either upload a picture of better quality, (in the picture please have 1 item in your inventory) or, let me borrow the account for a second please?
    Sure YoHoJo, PMing you the details now.

  4. #4
    Join Date
    Feb 2006
    Location
    Tracy/Davis, California
    Posts
    12,631
    Mentioned
    135 Post(s)
    Quoted
    418 Post(s)

    Default


    BYAM BITCH!
    Not too hard, but kind of :/.

    Here is the link to the ACA file:
    http://up.ht/tymLl4
    So you can add/remove colors as you wish.

    If you don't already know, learn about/download auto color aid here:
    http://villavu.com/forum/showthread.php?t=26944

    If you are lazy and need results NAO you can just use this code:
    Simba Code:
    function FrogColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.59, 0.16);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 2521930, MSX1, MSY1, MSX2, MSY2, 3);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 8.05) and (X <= 13.07) and (Y >= 12.87) and (Y <= 19.35) and (Z >= 3.63) and (Z <= 5.16) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    Basically paste that into your script before your frog finding function.
    And lets say you're using Findcolor, you would just enter 'FrogColor' where the color parameter is, example:
    Simba Code:
    If FindColor(X, Y, FrogColor, MSX1, MSY1, MSX2, MSY2) Then
      Begin
        Writelb('FROG!');
        MMouse(x,y 1, 1);
        If IsUpText('fr') Then
        Mouse(X, Y, 0, 0, True)
       End;

    All done with your account now, feel free to change password or whatever.

  5. #5
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by YoHoJo View Post

    BYAM BITCH!
    Not too hard, but kind of :/.

    Here is the link to the ACA file:
    http://up.ht/tymLl4
    So you can add/remove colors as you wish.

    If you don't already know, learn about/download auto color aid here:
    http://villavu.com/forum/showthread.php?t=26944

    If you are lazy and need results NAO you can just use this code:
    Simba Code:
    function FrogColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.59, 0.16);

      FindColorsSpiralTolerance(MSCX, MSCY, arP, 2521930, MSX1, MSY1, MSX2, MSY2, 3);
      if (Length(arP) = 0) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToXYZ(arC[i], X, Y, Z);

        if (X >= 8.05) and (X <= 13.07) and (Y >= 12.87) and (Y <= 19.35) and (Z >= 3.63) and (Z <= 5.16) then
        begin
          Result := arC[i];
          Writeln('AutoColor = ' + IntToStr(arC[i]));
          Break;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);
      SetColorSpeed2Modifiers(0.2, 0.2);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    Basically paste that into your script before your frog finding function.
    And lets say you're using Findcolor, you would just enter 'FrogColor' where the color parameter is, example:
    Simba Code:
    If FindColor(X, Y, FrogColor, MSX1, MSY1, MSX2, MSY2) Then
      Begin
        Writelb('FROG!');
        MMouse(x,y 1, 1);
        If IsUpText('fr') Then
        Mouse(X, Y, 0, 0, True)
       End;

    All done with your account now, feel free to change password or whatever.
    THANK YOU YOHOJO! ++REP!!

    Never really looked into the ACA, will do that now!

  6. #6
    Join Date
    Feb 2009
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    I've ran into a problem here

    Even though Mark Color and Mark Best Color finds the toads perfectly in ACA, it doesn't seem to work at all in the real RS client.

    Tried both your colours and I also tried making my own. Only result is AutoColor failed in finding the color.

    E: Figured out the problem! WORKS FLAWLESS NOW
    Last edited by Yanhua; 12-21-2011 at 04:19 AM.

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
  •