Results 1 to 22 of 22

Thread: A Little New Autocolor Function By Me...

  1. #1
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default A Little New Autocolor Function By Me...

    Now I added an Alkharid auto road color function! For those of you who already read this thread, please take your time to read through the new one, thanks!

    Some people might still remember my old autocolor function for the mining rocks in the mining guild, it worked quite well, but i guess jagex made some big color change at somepoint, because it doesn't work correctly anymore. oh well, i might update that once i get time, but until then, here is another function which is quite useful in alkharid. ^^
    SCAR Code:
    program New;
    {.include srl/srl.scar}

    var
      GArea, GTol, x, y, i, t: Integer;

    function PureRockDDTM: Integer;
    var
      PRMainPoint: TDTMPointDef;
      PRSubPoints: Array [0..4] of TDTMPointDef;
      PureRockTDTM: TDTM;
    begin
      PRMainPoint.x := 766;
      PRMainPoint.y := 247;
      PRMainPoint.AreaSize := 1;
      PRMainPoint.AreaShape := 0;
      PRMainPoint.Color := 2840716;
      PRMainPoint.Tolerance := GTol;

      PRSubPoints[0].x := 766;
      PRSubPoints[0].y := 247;
      PRSubPoints[0].AreaSize := GArea;
      PRSubPoints[0].AreaShape := 0;
      PRSubPoints[0].Color := 2840716;
      PRSubPoints[0].Tolerance := GTol;

      PRSubPoints[1].x := 766;
      PRSubPoints[1].y := 251;
      PRSubPoints[1].AreaSize := GArea;
      PRSubPoints[1].AreaShape := 0;
      PRSubPoints[1].Color := 1654631;
      PRSubPoints[1].Tolerance := GTol;

      PRSubPoints[2].x := 770;
      PRSubPoints[2].y := 248;
      PRSubPoints[2].AreaSize := GArea;
      PRSubPoints[2].AreaShape := 0;
      PRSubPoints[2].Color := 2840716;
      PRSubPoints[2].Tolerance := GTol;

      PRSubPoints[3].x := 766;
      PRSubPoints[3].y := 244;
      PRSubPoints[3].AreaSize := GArea;
      PRSubPoints[3].AreaShape := 0;
      PRSubPoints[3].Color := 3367836;
      PRSubPoints[3].Tolerance := GTol;

      PRSubPoints[4].x := 763;
      PRSubPoints[4].y := 248;
      PRSubPoints[4].AreaSize := GArea;
      PRSubPoints[4].AreaShape := 0;
      PRSubPoints[4].Color := 2444664;
      PRSubPoints[4].Tolerance := GTol;

      PureRockTDTM.MainPoint := PRMainPoint;
      PureRockTDTM.SubPoints := PRSubPoints;
      Result := AddDTM(PureRockTDTM);
    end;

    function PureRockAutocolor: integer;
    begin
      Status('Looking for the rock auto color DDTM...');
      GTol:= 0;
      GArea:= 0;
      for i:= 0 to 5 do
      begin
        GTol:= i*3+15;
        GArea:= i+2;
        if (DTMRotated(PureRockDDTM, x, y, MMX1, MMY1, MMX2, MMY2)) then
        begin
          Result:=GetColor(x,y);
          Writeln('RockColor = '+IntToStr(Result));
          exit;
        end;
      end;
      Writeln('RockColor NOT Found!');
      Result:=0;
      TerminateScript;
    end;

    begin
      t:=0;
      ActivateClient;
      Wait(1000);
      MarkTime(t);
      Writeln(IntToStr(PureRockAutocolor));
      Writeln('Took '+IntToStr(TimeFromMark(t))+' ms');
    end.
    Here is the pic of the rock it detects 100% of the time (haven't tried the others yet, but it should work on them, too, they are quite similar:


    My only recorded time so far was:
    SCAR Code:
    Successfully compiled (1060 ms)
    RockColor = 2840716
    2840716
    Took 32 ms
    Successfully executed
    I guess that is pretty good ^^

    Feel free to comment, post constructive critisism. (I might try to make one with RGB coloring once I have more experience with the parameters, until then, anyone who is too lazy/not experienced enough, feel free to use this, but you must give me credits... )

    ~~~~~Another function by me~~~~~
    This One detects the road and building color in Alkharid:
    SCAR Code:
    program New;
    {.include srl/srl.scar}
    var
      GTol, GArea, x, y, i, t, ICounter: Integer;

    function FindAlkharidBuildingDDTM: Integer;
    var
      FAMainPoint: TDTMPointDef;
      FASubPoints: Array [0..4] of TDTMPointDef;
      FindAlkharidBuildingTDTM: TDTM;
    begin
      FAMainPoint.x := 806;
      FAMainPoint.y := 311;
      FAMainPoint.AreaSize := 1;
      FAMainPoint.AreaShape := 0;
      FAMainPoint.Color := 5932165;
      FAMainPoint.Tolerance := GTol;

      FASubPoints[0].x := 813;
      FASubPoints[0].y := 318;
      FASubPoints[0].AreaSize := GArea;
      FASubPoints[0].AreaShape := 0;
      FASubPoints[0].Color := 5932165;
      FASubPoints[0].Tolerance := GTol;

      FASubPoints[1].x := 799;
      FASubPoints[1].y := 304;
      FASubPoints[1].AreaSize := 1;
      FASubPoints[1].AreaShape := 0;
      FASubPoints[1].Color := 5932165;
      FASubPoints[1].Tolerance := GTol;

      FASubPoints[2].x := 799;
      FASubPoints[2].y := 318;
      FASubPoints[2].AreaSize := GArea;
      FASubPoints[2].AreaShape := 0;
      FASubPoints[2].Color := 5932165;
      FASubPoints[2].Tolerance := GTol;

      FASubPoints[3].x := 813;
      FASubPoints[3].y := 304;
      FASubPoints[3].AreaSize := GArea;
      FASubPoints[3].AreaShape := 0;
      FASubPoints[3].Color := 5932165;
      FASubPoints[3].Tolerance := GTol;

      FASubPoints[4].x := 799;
      FASubPoints[4].y := 304;
      FASubPoints[4].AreaSize := GArea;
      FASubPoints[4].AreaShape := 0;
      FASubPoints[4].Color := 5932165;
      FASubPoints[4].Tolerance := GTol;

      FindAlkharidBuildingTDTM.MainPoint := FAMainPoint;
      FindAlkharidBuildingTDTM.SubPoints := FASubPoints;
      Result := AddDTM(FindAlkharidBuildingTDTM);
    end;

    function PureAlkhiBuildingColor: Integer;
    begin
      GArea :=1;
      GTol :=0;
      ICounter := 0;
      for i:=0 to 15 do
      begin
        GTol:= i * 5;
        Icounter := ICounter + 1;
        if (ICOunter mod 3 = 0) then GArea := GArea + 1;
        if DTMRotated(FindAlkharidBuildingDDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
        begin
          Writeln('Color found with a Tolerance of '+IntToStr(GTol));
          Result:= GetColor(x, y);
          Writeln('AlkharidBuildingColor = '+IntToStr(Result));
          Exit;
        end;
      end;
      Result := 0;
      Writeln('AlkharidBuildingColor NOT Found!');
    end;

    begin
      ActivateClient;
      Wait(1000);
      MakeCompass('N');
      MarkTime(t);
      Writeln(IntToStr(PureAlkhiBuildingColor));
      Writeln('The search took '+IntToStr(TimeFromMark(t))+'ms');
    end.

    And again, a report on how it went:
    SCAR Code:
    Successfully compiled (1053 ms)
    Color found with a Tolerance of 25
    AlkharidBuildingColor = 5011320
    5011320
    The search took 1594ms
    Successfully executed

    I know, i know, this is kinda slow, and it causese a lag for less than 1 sec, but this was the worst world, and it took some experimenting, because if the SPs are too close to the MP, it detetcts the color on the stuff surrounding the minimap, so yeah... But oh well, it works, any suggestions on how to make it better?



    EDIT: OMG, I am a King Black Dragon! (Now let's go pown some noobs who are trying to kill me in my cave... xD)

    EDIT 2: Added a few more lines into the PureRockAutocolor function to make it saver if i should be used more than once.
    There is nothing right in my left brain and there is nothing left in my right brain.

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

    Default

    Yes i remember your old AutoColor function Good Job on this Btw, you can just use FindRockColor if im not wrong


  3. #3
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Tried it, but it failed utterly ^^
    There is nothing right in my left brain and there is nothing left in my right brain.

  4. #4
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, Cazax, but it is broken at the moment as far as I know. There are fixes, and they are pretty easy to make, yes, but if JaGex continues to make theese small changes constantly, this is a genious alternative! Well done, Stur!

    Maybe this would be good as a backup, as in something like this?
    SCAR Code:
    if FindRockColor > 0 then
      RockColor := PureRockAutocolor;

    Why as a backup? Because, the SRL one is a lot more accurate.
    Great job, Stur. Rep+

  5. #5
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks a lot!

    Hehe, never thought that somthing i would make will be called genious... Sweetness... xD
    There is nothing right in my left brain and there is nothing left in my right brain.

  6. #6
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Wait, sorry for spamming, but I just thought of one important thing.
    You've taken into consideration that the pixels shift, right?
    (That the rock does not allways maintain the same shape.)

    Edit: Thanks for your answer.
    You should make more tutorials. Yours are fun and interesting to read. ^^

  7. #7
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, I have taken it into consideration. As long as the compass is pointing north, there is no problem, but it should also work with any other angle. The thing is, the colors don't disappear, they just change slightly change their location, and by increasing the area a bit, which it does by itself, it detects the pixels, even if it is not a 100% match. All the pixel change will affect is which part of that rock is being colored. In the best case scenario, the MP is directly where the biggest part of the color should be, but if the pixels are slightly off, it will color some other part of the rock, but unless you are working with ddtms/dtms which need 100% accuracy (which you shoul never do though), it wouldn't affect it at all in the outcome, so yeah, no problem with those little shifts.
    There is nothing right in my left brain and there is nothing left in my right brain.

  8. #8
    Join Date
    May 2007
    Location
    Ohio
    Posts
    2,296
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    How About This?

    SCAR Code:
    If (FindStoneColor = 0) Then
      RockColor := PureRockAutocolor;
    If (Not RockColor > 0) Then
    Begin
      NextPlayer(False);
      WriteLn('Failed Auto Coloring');
      Exit;
    End;

  9. #9
    Join Date
    Dec 2006
    Location
    Sweden
    Posts
    10,812
    Mentioned
    3 Post(s)
    Quoted
    16 Post(s)

    Default

    @EvilChicken: Yeah, those stupid little changes Jagex likes pushing our buttons... how about we design a new autocolor that for Jagex to mess it up, they would need to mess up the game more than they already have


    Send SMS messages using Simba
    Please do not send me a PM asking for help; I will not be able to help you! Post in a relevant thread or make your own! And always remember to search first!

  10. #10
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    Quote Originally Posted by Hy71194 View Post
    @EvilChicken: Yeah, those stupid little changes Jagex likes pushing our buttons... how about we design a new autocolor that for Jagex to mess it up, they would need to mess up the game more than they already have
    like rotation items in inventory and rotating game tabs

  11. #11
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    does this allways work? allways?!

    If yes i'll use it to fix my iron miner and give you a credit.

  12. #12
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    1337 our script is gonna be cool, hope so.
    ~Hermen

  13. #13
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    After many tests and experiments, I am proud to present you with the results.
    -The color was found 100% of the time!
    -In 7 different minimap locations!
    -With an average speed of 40,6ms!
    Here are the locations:

    Little side info, it won't find the color of every rock, tbecause it only finds the rock which looks like the one close to alkharid bank. but luckyly, in every bundle of rocks the is more than one which looks like it, so it finds the color of that rock. But, all the other rocks have that color included, so for example if i use findcolorsspiraltolerance, it finds all of them, and with MMouse, it moves the mouse to all of them, so yeah, technically, it finds every rock
    There is nothing right in my left brain and there is nothing left in my right brain.

  14. #14
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    He's cheating i'm sure, he is paying the jury off with cookies, how i know that.
    try to guess it.
    ~Hermen

  15. #15
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Hermpie View Post
    He's cheating i'm sure, he is paying the jury off with cookies, how i know that.
    try to guess it.
    OMFG! Hermpie! I told you to shut up if you found anything specific! Now my entire plot is laid bare! You'd better watch out in the dark, cause I'll be there someday ......
    xD
    ah heck, just joking, i don't give out cookies, i eat all i have, so yeah, i can't give out cookies....
    There is nothing right in my left brain and there is nothing left in my right brain.

  16. #16
    Join Date
    Jun 2007
    Location
    La Mirada, CA
    Posts
    2,484
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    how did you get the subpoint and mainpoint colors? just randomly pick the rock colors or did you get an 'average' color?

    "Failure is the opportunity to begin again more intelligently" (Henry Ford)


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

    Default

    This new function will be included in the next version of SRL.

    If anyone needs to use it before then, feel free.


  18. #18
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by tarajunky View Post
    This new function will be included in the next version of SRL.

    If anyone needs to use it before then, feel free.
    Tara when i openened it i saw a bug i saw the color 7200 the ones at the furnace around the 3 hourses is 7500 to 7900 i know colors are not right but they start with those 2 numbers.
    ~Hermen

  19. #19
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by HyperSecret View Post
    how did you get the subpoint and mainpoint colors? just randomly pick the rock colors or did you get an 'average' color?
    No, neither, the colors i chose represent the darkest point of the rock, down to the brightest one, the Main Point is the one appearing the most often, and i think it is just in the middle brightness, but I am not 100% sure. I used that so there is a bigger color difference so it doesn't mistake anything else for the rock I am looking for.

    Quote Originally Posted by tarajunky View Post
    This new function will be included in the next version of SRL.

    If anyone needs to use it before then, feel free.
    Um... Wouldn't this be hijacking my thread...?

    EDIT: Intresting... I post this in the public section, and yet only members reply... i thought at least one leecher would write something like: "Wow, great! Good Job! Rep++ for You!"... I am dissapointed.... xD
    There is nothing right in my left brain and there is nothing left in my right brain.

  20. #20
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pure1993 View Post
    No, neither, the colors i chose represent the darkest point of the rock, down to the brightest one, the Main Point is the one appearing the most often, and i think it is just in the middle brightness, but I am not 100% sure. I used that so there is a bigger color difference so it doesn't mistake anything else for the rock I am looking for.


    Um... Wouldn't this be hijacking my thread...?

    EDIT: Intresting... I post this in the public section, and yet only members reply... i thought at least one leecher would write something like: "Wow, great! Good Job! Rep++ for You!"... I am dissapointed.... xD
    Can i play like one! Its not that hard for me!

    Leecher:
    Great Fletching script 1337 i got even a proggy for you

    Script ran for 99:99:99 hours
    Fish catch:3

    Thanks!
    ~Hermen

  21. #21
    Join Date
    Jan 2008
    Location
    Frankfurt, Germany
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    That post was epic... This is one memory I am not willing to lose, you are going right into my sig mister... xD
    There is nothing right in my left brain and there is nothing left in my right brain.

  22. #22
    Join Date
    Apr 2007
    Location
    The Netherlands
    Posts
    5,553
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Pure1993 View Post
    That post was epic... This is one memory I am not willing to lose, you are going right into my sig mister... xD
    yay!, w00t i want tah l33ch3r cup
    ~Hermen

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. new autocolor function quite fast
    By Waddo in forum Research & Development Lounge
    Replies: 4
    Last Post: 05-11-2008, 09:13 PM
  2. Universal AutoColor function
    By Cazax in forum Research & Development Lounge
    Replies: 3
    Last Post: 02-28-2008, 01:50 PM
  3. AutoColor help
    By The Kool Aid Man in forum OSR Help
    Replies: 5
    Last Post: 11-27-2006, 04:44 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
  •