Results 1 to 6 of 6

Thread: AutoColor Function Not Working

  1. #1
    Join Date
    Jun 2009
    Location
    New Jersey
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default AutoColor Function Not Working

    SCAR Code:
    function FindBankFloorColor: integer;
    var
      i, Red, Green, Blue, GC, TestColor: integer;
      TPA: TPointArray;
    begin
      GC := 5012614;
      FindColorsSpiralTolerance(MMCX, MMCY, TPA, GC, MMX1, MMY1, MMX2, MMY2, 6);
      for i :=0 to High(TPA) do
      begin
        if rs_OnMinimap(TPA[i].x,TPA[i].y)then
        begin
          TestColor := GetColor(TPA[i].x,TPA[i].y)
          ColorToRGB(TestColor, Red, Green, Blue);
          if(InRange(Red - Blue, 45, 68))then
            if(InRange(Red - Green, 10, 30))then
              if(InRange(Green - Blue, 24, 55))then
                if GetColor(TPA[i].x + 2, TPA[i].y + 2) = TestColor then
                  if GetColor(TPA[i].x + 1, TPA[i].y + 1) = TestColor then
                    if GetColor(TPA[i].x, TPA[i].y + 2) = TestColor then
                      if GetColor(TPA[i].x + 2, TPA[i].y) = TestColor then
                        if GetColor(TPA[i].x, TPA[i].y + 1) = TestColor then
                          if GetColor(TPA[i].x + 1, TPA[i].y) = TestColor then
                            if GetColor(TPA[i].x + 2, TPA[i].y + 1) = TestColor then
                              if GetColor(TPA[i].x + 1, TPA[i].y + 2) = TestColor then
                              begin
                                Result := TestColor;
                                Writeln('Bank Floor Color is ' + IntToStr(Result));
                                Exit;
                              end;
        end;
      end;
      Result := 0;
      writeln('wtf dude!');
    end;


    It compiles, but doesn't get the color of the road. If anyone could help I'd love you forever.
    Take a look at a new OpenDepositBox here.

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It is very likely with all the conditions that you need to be true before deciding what the road color is that one of them will fail, and you will never find the road color. If you want to find a good way for map walking with TPA's, I do something very similar in my tutorial with a red rug color in the bank:

    http://www.villavu.com/forum/showthread.php?t=48915

    Try like a (this is psuedo code obviously):

    SCAR Code:
    FindColorsSpiralTolerance(TPA, for the road color, MMX1,MMY1,MMX2,MMY2...etc.);
    for i := 0 to High(TPA)do
    begin
      FindColorsSpiralTolerance(TPA2,the road color,TPA[i].x-15,TPA[i].y-15,TPA[i].x+15,TPA[i].y+15);
      if(GetArrayLength(TPA2) > 25)then //it must be the road color
      begin
        Result := GetColor(TPA[i].x,TPA[i].y); //road color
        Exit;
      end;
    end;

    Search for all the colors you think might be the road color and store in a TPA.

    For each of those points, check a small box around them for the suspected road color, and if there are a certain amount of colors around it (getarraylength), then it must be the road color.

    If you have any questions I can help you 1 on 1 on msn: runescapemacro@hotmail.com
    Last edited by JAD; 08-17-2009 at 05:38 AM.

  3. #3
    Join Date
    Jun 2009
    Location
    New Jersey
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    So should I just do the "if(InRange...))" statements and not the other ones?
    Take a look at a new OpenDepositBox here.

  4. #4
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    hmm, why dont you try CTS3? im not sure if it would work in your situation, but its worth a try

    SCAR Code:
    function findroad : tpoint;
    var cur_cts : integer; tpa : tpointarray;
    begin
      cur_cts := getcolortolerancespeed;
      ColorToleranceSpeed(3);
      if FindColorsSpiralTolerance(mmcx, mmcy, tpa, 5012614, mmx1, mmy1, mmx2, mmy2, 7) then
        result := point(tpa[high(tpa)].x, tpa[high(tpa)].y);
       
      colortolerancespeed(cur_cts);
    end;

    thats simple tbh, but it should work. it returns the x and y cord of a point on the road. it should return the highest tpoint(the furthest) on the minimap
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  5. #5
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Xanith View Post
    So should I just do the "if(InRange...))" statements and not the other ones?
    You could take out some conditions (I don't know much about using RGB), or you could take a look at my edited post and tutorial and see if you like my method of finding it.

  6. #6
    Join Date
    Jun 2009
    Location
    New Jersey
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    hmm, why dont you try CTS3? im not sure if it would work in your situation, but its worth a try

    SCAR Code:
    function findroad : tpoint;
    var cur_cts : integer; tpa : tpointarray;
    begin
      cur_cts := getcolortolerancespeed;
      ColorToleranceSpeed(3);
      if FindColorsSpiralTolerance(mmcx, mmcy, tpa, 5012614, mmx1, mmy1, mmx2, mmy2, 7) then
        result := point(tpa[high(tpa)].x, tpa[high(tpa)].y);
       
      colortolerancespeed(cur_cts);
    end;

    thats simple tbh, but it should work. it returns the x and y cord of a point on the road. it should return the highest tpoint(the furthest) on the minimap

    I'll try that now, but It's for the varrok bank and I don't want to walk to the furthest on the mm so I'll change high to low.
    Take a look at a new OpenDepositBox here.

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
  •