Results 1 to 10 of 10

Thread: my multipurpose autocolor keeps failing?

  1. #1
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default my multipurpose autocolor keeps failing?

    can anyone tell me whats going wrong with this

    SCAR Code:
    var
     ColorToFind: integer;
    {*******************************************************************************
    function function MyAutoColor: Integer;
    By: Tazzin44
    Description: autocolors whatever you need just remember to declare the variable
                 ColorToFind in the procedure/function you are using this in
                 ColorToFind is, simply put the color you need to autocolor.
    *******************************************************************************}



    function MyAutoColor: Integer;
    var
      I, C2, Red, Green, Blue, TestColor: Integer;
      TP: TPointArray;
      C1 : TIntegerArray;

    begin
      FFlag(0);  //
      FindColorsSpiralTolerance(MMCX, MMCY, TP, ColorToFind, MMX1, MMY1, MMX2, MMY2, 70); //searches for the color from the center out
      C1 := GetColors(TP);
      C2 := High(C1);
      for I:=0 to C2 do
      begin
        if rs_OnMinimap(TP[i].x,TP[I].y) then // checks to see if the color is on the minimap
          begin
            TestColor := GetColor(TP[I].x,TP[I].y);
            ColorToRGB(TestColor, Red, Green, Blue);
            if InRange((Red - Green),5,10) then
              if InRange((Red - Blue),4,10) then
                  if GetColor(TP[I].x + 2, TP[I].y + 2) = TestColor then
                    if GetColor(TP[I].x + 1, TP[I].y + 1) = TestColor then
                      if GetColor(TP[I].x, TP[I].y + 2) = TestColor then
                        if GetColor(TP[I].x + 2, TP[I].y) = TestColor then
                          if GetColor(TP[I].x, TP[I].y + 1) = TestColor then
                            if GetColor(TP[I].x + 1, TP[I].y) = TestColor then
                              if GetColor(TP[I].x + 2, TP[I].y + 1) = TestColor then
                                if GetColor(TP[I].x + 1, TP[I].y + 2) = TestColor then
                                   begin
                                     Result := TestColor;
                                     Writeln('The Color you are looking for = '+IntToStr(Result));
                                     exit;
          end;
      end;
      WriteLn('Color could NOT be Found!');
      Result := 0;
      Exit;
    end;
    end;
    procedure testwalk;
    begin
      ColorToFind := 6776944;
      MyAutoColor;
      RadialWalk(MyAutoColor, 350, 315, 72, 1,1)
    end;
    begin
    setupsrl
    testwalk;
    end.

    I've been making this with the help of tuts/ autocolor.scar (for the range when all my ranges fail) ... i put some writeln's in to debug it and it seems to not pass the statement
    SCAR Code:
    if GetColor(TP[I].x + 2, TP[I].y + 2) = TestColor then
    if any one could offer suggestions? also any suggestions on a more efficient way to making it multi purpose (right now I have it so the variable ColorToFind Is a Global in the script, and then its used value for a single instance is declared in a procedure right before the autcolor is called)
    At sea with the navy - not very active

  2. #2
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What are you autocoloring? There are two solutions: expand the RGB ranges or don't check sorrounding colors.


  3. #3
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    What are you autocoloring? There are two solutions: expand the RGB ranges or don't check sorrounding colors.
    ahh the percect person for this since Im using your tut as one of my references

    Im trying to autocolor the road in rimm (findroadcolor doesnt work it finds the archery store floor color) ive been playing around with tolerences and ranges and still nothing
    At sea with the navy - not very active

  4. #4
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    if GetColor(TP[i].x + 2, TP[i].y + 2) = TestColor then

    That line and all the other similar lines after it are used when you want to find a block of uniform color. If you don't have a 3x3 solid chunk of that one color, it will never find it.

    Edit:
    SCAR Code:
    FindColorsSpiralTolerance(MMCX, MMCY, TP, ColorToFind, MMX1, MMY1, MMX2, MMY2, 70); //searches for the color from the center out
      C1 := GetColors(TP);
      C2 := High(C1);
      for I:=0 to C2 do

    When you're looking for a chunk of color, you could find the correct color and still reject it because it's not in a chunk. You should probably skip the GetColors step and just brute force check every color that you find in the original search.

    SCAR Code:
    FindColorsSpiralTolerance(MMCX, MMCY, TP, ColorToFind, MMX1, MMY1, MMX2, MMY2, 70); //searches for the color from the center out
      C2 := High(TP);
      for I:=0 to C2 do


  5. #5
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change:
    SCAR Code:
    if InRange((Red - Green),5,10) then
              if InRange((Red - Blue),4,10) then
    To:
    SCAR Code:
    if InRange((Red - Green),2,10) then
              if InRange((Red - Blue),1,10) then


  6. #6
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Cazax View Post
    Change:
    SCAR Code:
    if InRange((Red - Green),5,10) then
              if InRange((Red - Blue),4,10) then
    To:
    SCAR Code:
    if InRange((Red - Green),2,10) then
              if InRange((Red - Blue),1,10) then
    I changed it and still nothing

    there is definately a showing 3x3 portion of the color I can see rimm sqr from where I am plenty of road to see but none found?

    if it will help you help me I can post a screeny of my location?
    At sea with the navy - not very active

  7. #7
    Join Date
    Nov 2007
    Location
    Chile
    Posts
    1,901
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Change:
    SCAR Code:
    end;
      end;
      WriteLn('Color could NOT be Found!');
      Result := 0;
      Exit;
    end;
    end;
    TO:
    SCAR Code:
    end;
        end;
      end;
      WriteLn('Color could NOT be Found!');
      Result := 0;
      Exit;
    end;
    You were exiting from the loop after the first try.


  8. #8
    Join Date
    Jan 2008
    Location
    NC, USA.
    Posts
    4,429
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Did you put in the colour to Find?

    ColorToFind := #;

    Looks like you did nt put that in there It is currently looking for 0.
    Quote Originally Posted by irc
    [00:55:29] < Guest3097> I lol at how BenLand100 has become noidea
    [01:07:40] <@BenLand100> i'm not noidea i'm
    [01:07:44] -!- BenLand100 is now known as BenLand42-
    [01:07:46] <@BenLand42-> shit
    [01:07:49] -!- BenLand42- is now known as BenLand420
    [01:07:50] <@BenLand420> YEA

  9. #9
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    There may BE a 3x3 chunk of color on the screen, but are you CHECKING every pixel?

    See my edit above.

    Edit: If not that, I think Cazax is right. You don't need that last exit at all, do you?


  10. #10
    Join Date
    May 2007
    Location
    in the forest
    Posts
    190
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    you both were right i switched it to your method and fixed the ends
    ty guys
    At sea with the navy - not very active

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Fuctions just failing on me
    By SirPa in forum OSR Help
    Replies: 10
    Last Post: 11-05-2008, 10:45 AM
  2. login failing?
    By zildjohn01 in forum OSR Help
    Replies: 8
    Last Post: 05-01-2008, 02:21 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
  •