Results 1 to 3 of 3

Thread: Autocoloring Help

  1. #1
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autocoloring Help

    OK, I thought that I understood this, but maybe I don't.
    SCAR Code:
    program New;
    {.include SRL/SRL.scar}

    var
    FaladorGrass, SimilarColor ,red, green, blue, a, x, y : integer; J: array of TPoint;
    begin
      SimilarColor := 2662783
      FindColorTolerance(x, y, SimilarColor, MMX1, MMY1, MMX2, MMY2, 30);
      red := (SimilarColor mod 256);
      green := ((SimilarColor / 256) mod 256);
      blue := ((SimilarColor / 256) / 256);
      writeln('Red equals ' + inttostr(red));
      writeln('Green equals ' + inttostr(green));
      writeln('Blue equals ' + inttostr(blue));
      if Green >= Red then if Red >= Blue then
      begin
        if Green - Red <= 35 then if Green - Red >= 30 then
          if Green - Blue <= 125 then if Green - blue >= 110 then
            if Red - Blue <= 95 then if Red - Blue >= 77 then
              if GetColor(J[a].x, J[a].y) = SimilarColor then
                if GetColor(J[a].x + 1, J[a].y + 1) = SimilarColor then
                  if GetColor(J[a].x + 2, J[a].y + 2) = SimilarColor then
                    if GetColor(J[a].x + 3, J[a].y + 3) = SimilarColor then
                      if GetColor(J[a].x + 4, J[a].y + 4) = SimilarColor then
                        if GetColor(J[a].x + 5, J[a].y + 5) = SimilarColor then
                          if GetColor(J[a].x + 6, J[a].y + 5) = SimilarColor then
                            if GetColor(J[a].x + 7, J[a].y + 8) = SimilarColor then
                            begin
                              Writeln('The Falador Grass Color is ' +
                              inttostr(SimilarColor));
                              FaladorGrass := SimilarColor
                              FindColor(x,y,FaladorGrass,MMX1,MMY1,MMX2,MMY2);
                            end;
      end;
    end.
    I don't see this doing anything. To me, it looks like it just takes a random point then does nothing to it other than tell me what "The Falador Grass Color is" which STILL doesn't work.
    I got it to split into R/G/B.
    After that, it gives me "[Runtime Error] : Out Of Range in line 20 in script C:\Program Files\SCAR 3.12\Scripts\AutoColor.scar"
    I do not know how I should go about doing this.
    I do not want you to do it for me, I just want to know what the devil I'm doing wrong.
    This is very annoying. I had to use one of Tarajunky's functions for learning, so it is very similar.
    Active only during the Summer...

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

    Default

    You searched for the color, but then you never picked the color you found.

    Also, you aren't searching through many pixels to find the right one, you're just searching once.

    You also have several typos where you write SimiliarColor instead of SimilarColor.

    I suggest that you go into AutoColor.scar and copy one of the functions directly, then plug in the relevant numbers for the generic color and the R/G/B ranges. Then post what you have and people can help you test/tweak it from there.

    Also, check out the tutorial!

    http://www.villavu.com/forum/showthr...ight=autocolor

    I annotated one of the AutoColor functions in there, so you can see explanations for what all the different parts of the code are doing.


  3. #3
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Blegh, I thought I stamped all those out.

    I was aware that it was searching only once, but I don't know how to search multiple times without doing a loop.

    I know that I can copy and paste your* functions, but then I wouldn't really be learning much.

    Thanks, Tarajunky.
    Active only during the Summer...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. autocoloring
    By Shuttleu in forum OSR Help
    Replies: 0
    Last Post: 04-19-2008, 10:42 PM
  2. AutoColoring
    By king vash in forum OSR Help
    Replies: 3
    Last Post: 02-05-2008, 01:07 PM
  3. Help with autocoloring...
    By rockman in forum OSR Help
    Replies: 5
    Last Post: 01-24-2008, 11:30 PM

Posting Permissions

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