Results 1 to 4 of 4

Thread: obj finder

  1. #1
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default obj finder

    here it is my object finder

    SCAR Code:
    function ThingFinder(cx,cy,PColor:integer; SColor:tIntegerarray;  Text:TStringArray; Tolerance,Precision,scolors:Integer):Boolean;
    var px1,px2,py1,py2,Trys,t,ms:Integer;
    begin
      ms:=mousespeed;
      mousespeed:=50;
      Repeat
      t:=random(scolors);
      wait(1000);
      writeln(inttostr(trys));
        if FindColorspiraltolerance(x,y,PColor,MSx1,MSy1,MSx2,MSy2,2) then
        begin
          px1 := x-Precision;
          px2 := x+Precision;
          py1 := y-Precision;
          py2 := y+Precision;
          if FindColorspiraltolerance(x,y,scolor[t],px1,py1,px2,py2,Tolerance) then
          begin
            MMouse(x,y,2,2);
            if isuptextmulticustom(Text) then result:=true;
          end;
        end;
        trys:=trys+1;
      until ((Result=True) or(Trys>=5));
      if Result=True then Writeln('Thing Found');
      if Result=False then Writeln('Couldnt Find Thing');
      Trys:=0;
      mousespeed:=ms;
    end;

    howto declare it

    SCAR Code:
    ThingFinder(x,y,7833746,[2702921,3295831,2573652],['ooth','Bank'],10,10,3);

    SCAR Code:
    ThingFinder(x,y,a color that is rare ,[secondary colours],[uptext],tolerance,the area around the primary color to look for secondary colors,number of secondary colours)

    please test it out and tell me if you have any improvements
    Blank!

  2. #2
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    instead of scolors, try Length(SColor) in the script and the repeat won't work, it will find the same pixel every time, since it starts looking at x,y so after the first time, it will start looking at the pixel it found the color, so it won't change anything.
    honestly it isn't brilliant or anything, but if you make a couple more functions of the same quality and integrate them in a script, you might make it to members oh and a hint on object finding: TPA
    Infractions, reputation, reflection, the dark side of scripting, they are.

  3. #3
    Join Date
    Apr 2008
    Location
    Northwest england
    Posts
    1,179
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    yes mixster has mentioned tpa but im still learning tpas

    but then i will use them
    Blank!

  4. #4
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    SCAR Code:
    function FindObjectWaddo(var x, y: Integer; primCol: Integer; secCols: TIntegerArray; Tol, Precision: Integer; UpText: TStringArray): Boolean;
    var
      tries, i, ii, iii: Integer;
      pPts, sPts, mPts: TPointArray;
      sPtsA: array of TPointArray;
    begin
      Result := False;  
      while tries <= 5 do
      begin
        Inc(tries);
       
        // Reset all TPA's just to make sure there aren't old points in it
        SetArrayLength(pPts, 0);
        SetArrayLength(sPts, 0);
        SetArrayLength(mPts, 0);
        SetArrayLength(sPtsA, High(SecCols) + 1);
        for i := 0 to High(sPtsA) do
          SetArrayLength(sPtsA[i], 0);

        // Find primary colour matching points into pPts
        if not FindColorsTolerance(pPts, primCol, MSX1, MSY1, MSX2, MSY2, Tol) then
          Continue;

        // Find all secondary colour mathing points into sPtsA[]
        for i := 0 to High(secCols) do
        begin
          FindColorsTolerance(sPtsA[i], secCols[i], MSX1, MSY1, MSX2, MSY2, Tol);
          IncEx(ii, High(sPtsA[i]) + 1); // Increase length counter
        end;

        if ii = 0 then
          Continue;
        SetArrayLength(sPts, ii); // Set sPts to the same length as all of sPtsA
       
        // Put all points from sPtsA into sPts
        for i := 0 to High(sPtsA) do
          for ii := 0 to High(sPtsA[i]) do
          begin
            if High(sPtsA[ii]) = 0 then
              Continue;
            sPts[iii] := sPtsA[i][ii];
            Inc(iii);
          end;

        // Check all points to see if they are in precision range of a main point and secondary point
        for i := 0 to High(pPts) do
          for ii := 0 to High(sPts) do
            if (InRange(pPts[i].x, sPts[ii].x - Precision, sPts[ii].x + Precision) and (InRange(pPts[i].y, sPts[ii].y - Precision, sPts[ii].y + Precision)))then
            begin
              SetArrayLength(mPts, High(mPts) + 2);
              mPts[High(mPts)].x := pPts[i].x;
              mPts[High(mPts)].y := pPts[i].y;
            end;
           
        if High(mPts) < 0 then
          Continue;

        // Check all matching points for UpText matches
        for i := 0 to High(mPts) do
        begin
          MMouse(mPts[i].x, mPts[i].y, 1, 1);
          if not IsUpTextMultiCustom(UpText) then
            Continue;
          x := mPts[i].x;
          y := mPts[i].y;
          Result := True;
          Exit;
        end;
      end;
    end;

    Basic TPA version based off Waddo's function with commenting on what the sections do for easy improving if anyone wants to
    P.S. I know it's pretty unreliable and can end up with 500 same points if you put in a few similar secondary colours and I haven't tested it (except for compile) so it may not even work, but it should atleast run without hitting errors and hopefully work fairly well
    Edit: I also use FindColorsTolerance rather than SpiralTolerance as for some reason it kept giving me type mismatches for the last variable even when I put in an integer rather than a variable...
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Creating a pick head finder, and gas finder
    By Tom_Gower in forum OSR Help
    Replies: 7
    Last Post: 11-07-2008, 07:06 AM
  2. My Ent Finder
    By skilld u in forum OSR Help
    Replies: 3
    Last Post: 02-11-2008, 04:13 PM
  3. need ent finder help
    By poolikemax in forum OSR Help
    Replies: 9
    Last Post: 02-07-2008, 09:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •