Results 1 to 6 of 6

Thread: Autocoloring in Rimmington

  1. #1
    Join Date
    Oct 2007
    Location
    Denmark
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Autocoloring in Rimmington

    SCAR Code:
    function AutoColorThings(What: String): Integer;
    var
      i, Red, Green, Blue, GoodColor, TestColor: Integer;
      RMG, RMB, GMB: Integer;
      P: array of TPoint;
      R: array of Integer;
    begin
      case Lowercase(What) of
        'dirt':
        begin
          GoodColor := 1388628;
          R := [57, 100, 14, 43, 21, 50];
        end;
        'stone':
        begin
          GoodColor := 4211519;
          R := [0, 20, 0, 20, 0, 20];
        end;
        'bstone':
        begin
          GoodColor := 3756678;
          R := [57, 106, 43, 69, 18, 73];
        end;
      end;
      FFlag(0);
      FindColorsSpiralTolerance(MMCX, MMCY, P, GoodColor, MMX1, MMY1, MMX2, MMY2, 50);
      for i := 0 to High(P) do
      begin
        if rs_OnMiniMap(P[i].x, P[i].y) then
        begin
          TestColor := GetColor(P[i].x, P[i].y);
          ColorToRGB(TestColor, Red, Green, Blue);
          RMB := Red - Blue;
          RMG := Red - Green;
          GMB := Green - Blue;
          if (RMB < 0) then
            RMB := (RMB * RMB) - RMB;
          if (RMG < 0) then
            RMG := (RMG * RMG) - RMG;
          if (GMB < 0) then
            GMB := (GMB * GMB) - GMB;
          if InRange(RMB, R[0], R[1]) then
           if InRange(RMG, R[2], R[3]) then
             if InRange(GMB, R[4], R[5]) then
                 if GetColor(P[i].x + 1, P[i].y + 1) = TestColor then
                   if GetColor(P[i].x, P[i].y + 2) = TestColor then
                     if GetColor(P[i].x + 2, P[i].y) = TestColor then
                       if GetColor(P[i].x, P[i].y + 1) = TestColor then
                         if GetColor(P[i].x + 1, P[i].y) = TestColor then
                           if GetColor(P[i].x + 2, P[i].y + 1) = TestColor then
                             if GetColor(P[i].x + 1, P[i].y + 2) = TestColor then
                             begin
                             Result := TestColor;
                             Writeln('Found color: ' + IntToStr(TestColor));
                             Exit;
                             end;
        end;
      end;
      Result := 0;
      Writeln('Could not autocolor ' + What);
    end;

    That is my autocoloring function.
    The problem is that the colorchange in the mine is so great that when I update it so it's working, 6 hours or so passes and the colors have changed so much that it doesn't find the colors.
    Another issue is that the roadcolor is so close to the grey rockcolor that it sometimes finds the roadcolor instead which causes it to walk to the road.

    Any help will be appreciated and credited
    Last edited by Frt; 04-14-2009 at 05:36 PM. Reason: Spelling

  2. #2
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I suggest reading this tutorial on how to create your own autocolor functions. It has been a great help to me and my autocolor functions are near to perfect on my current script.
    SCAR Code:
    if (YourActivity = 'ReadingThis') then
        Inc(ViewCount);

  3. #3
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    [offtopic]gear what language are you using for your sig? >.>

    it's like a mix between java and SCAR :/[/offtopic]

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

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

    Cazax's is really good

  4. #4
    Join Date
    Feb 2009
    Location
    UK
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It's supposed to be SCAR, you made me realise a typo I made in it, thanks.
    SCAR Code:
    if (YourActivity = 'ReadingThis') then
        Inc(ViewCount);

  5. #5
    Join Date
    Nov 2008
    Location
    Belgium
    Posts
    254
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Instead of
    ViewCount := ViewCount + 1;
    use Inc(ViewCount);

  6. #6
    Join Date
    Nov 2006
    Posts
    2,369
    Mentioned
    4 Post(s)
    Quoted
    78 Post(s)

    Default

    You could try using colortolerance speed 2
    Quote Originally Posted by DeSnob View Post
    ETA's don't exist in SRL like they did in other communities. Want a faster update? Help out with updating, otherwise just gotta wait it out.

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
  •