Results 1 to 10 of 10

Thread: How do i use AutoColor?

  1. #1
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default How do i use AutoColor?

    SCAR Code:
    program AutoColor;
    {.include SRL\SRL.scar}

    function AutoColor: Integer;
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
      x, y, Willow : Integer;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(1);

      if not (FindColorsTolerance(arP, 2254936, MSX1, MSY1, MSX2, MSY2, 38)) then
      begin
        Writeln('Failed to find the color, no result.');
        ColorToleranceSpeed(tmpCTS);
        Exit;
      end;

      arC := GetColors(arP);
      ClearSameIntegers(arC);
      arL := High(arC);

      for i := 0 to arL do
      begin
        ColorToHSL(arC[i], H, S, L);

        if (H >= 20.14) and (H <= 20.97) and (S >= 30.41) and (S <= 66.06) and (L >= 22.53) and (L <= 31.20) then
        begin
          ColorToXYZ(arC[i], X, Y, Z);

          if (X >= 5.13) and (X <= 14.90) and (Y >= 6.32) and (Y <= 19.92) and (Z >= 2.94) and (Z <= 4.11) then
          begin
            Result := arC[i];
            Writeln('AutoColor = ' + IntToStr(arC[i]));
            Break;
          end;
        end;
      end;

      ColorToleranceSpeed(tmpCTS);

      if (i = arL + 1) then
        Writeln('AutoColor failed in finding the color.');
    end;

    begin
      SetupSRL;
      AutoColor;
    end.

    This is an example if i Auto Colored a Willow tree. So how do i use it ? Like what do i do to make it work in my script. I tried multiple things, for one its like this

    SCAR Code:
    procedure ClickColor;
    begin
      Willow := AutoColor;
      if (FindColorTolerance(Willow, x, y, MSX1, MSY1, MSX2, MSY2, 25)) then
      Writeln('Found Color, now clicking');
      Mouse(x, y, 2, 2, true);
    end;
    begin
      if (not (FindColorTolerance(Willow, x, y, MSX1, MSY1, MSX2, MSY2, 25))) then  
      Writeln('Color did not work, go ask for help because we dont even know how to use this yet');
      TerminateScript;
    end;

    begin
      ActivateClient;
      Wait(2000); //Because RS tends to lag and the AutoColor procedure will not work. So we wait like 2 seconds for RS to not turn white.
      AutoColor;
      ClickColor;
    end.

    Thanks. (BTW i did read some guides and they only showed me this. Except for the Click procedure, that was my guess.

    Also that CLickColor procedure was made in like, 3minuites. so dun yell at me pl0x k?

  2. #2
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    that should work...

    SCAR Code:
    procedure ClickColor;
    begin
      Willow := AutoColor;
      if (FindColorTolerance(Willow, x, y, MSX1, MSY1, MSX2, MSY2, 1)) then //don't use tolerance, you auto colored it so color should be perfect.
      Writeln('Found Color, now clicking');
      MMouse(x, y, 5, 5);
      if IsUpText('illow') then
      begin
        Mouse(x, y, 0, 0, true); //no need for randomness, already used in MMouse.
        FFlag(0); //wait for flag to leave.
      end;
    end;

  3. #3
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    Oh Thanks! Ill test.

    EDIT:

    Line 52: [Error] (12657:1): Unknown identifier 'Willow' in script

    SCAR Code:
    var
      arP: TPointArray;
      arC: TIntegerArray;
      tmpCTS, i, arL: Integer;
      H, S, L: Extended;
      X, Y, Z: Extended;
      Willow : Integer;

    Come on! Why?! I put it in integers. Did i misplaced something?

    Sorry! I put Willow : Integer; in AutoColor function. Must put it in after {.include SRL/SRL.scar}

    thanks SKilld u, +Rep i had problems with this since a week ago.

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

    Default

    You need to declare Willow again in every procedure you want to use it in, or you need to put it at the top of the script so it's a global variable.


  5. #5
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    Yup thanks, btw is this smart to use in WCing?
    if not then what do i use that works more efficently??

  6. #6
    Join Date
    Aug 2007
    Location
    Georgia, U.S.
    Posts
    890
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It should work fine with woodcutting, but you didn't really need to autocolor the tree, just use tolerance

  7. #7
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    well as a new scripter attempting to become a SRL Member, i must use the most advanced functions. So i used AutoColor cuz it looks hard to me and advanced =D

  8. #8
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    Tolerances are easier, and better for what you are doing. If you want to look advanced; make a TPA function which works great.

    TPA's own regular color finding.

    Nava2
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  9. #9
    Join Date
    Dec 2006
    Posts
    908
    Mentioned
    1 Post(s)
    Quoted
    17 Post(s)

    Default

    TPA eh? Ill look that up.

  10. #10
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    2,984
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Quote Originally Posted by deathscytex View Post
    well as a new scripter attempting to become a SRL Member, i must use the most advanced functions. So i used AutoColor cuz it looks hard to me and advanced =D
    You will find out that often simplicity is best as long as it gets the job done.

    Your goal should be to get the job done in as little and easy code as possible. Find the balance between the two.

    Anyway I see you're using ACA, you can also make it create a Object finding function, that will move the mouse to the tree using tolerance like said above. It might not work too well with tree's however since a tree's colors change a lot. You might be better off using SRL's FindObjTPA, but you can always give it a shot with ACA.
    Administrator's Warning:


Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Doesn't AutoColor
    By BKNYKavkaz in forum OSR Help
    Replies: 5
    Last Post: 04-26-2008, 10:31 AM
  2. Help AUTOCOLOR???
    By papenco in forum OSR Help
    Replies: 0
    Last Post: 12-06-2007, 06:27 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
  •