Results 1 to 12 of 12

Thread: While SRL down I made 2 functions just to post em :)

  1. #1
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default While SRL down I made 2 functions just to post em :)

    Yeah, SRL was down about half an hour (?), and I was bored since I wasnt able to view threads, so I made two finding functions.

    1. FastFindAnvil - Finds anvil in ~78 milliseconds.
    2. FastFindVarrockFountain - Finds fountain in ~30 milliseconds.

    Anvil finder is good for smithing scripts and fountain one for clay softeners etc.

    Both pretty simple, both work even better.

    SCAR Code:
    Function FastFindAnvil(Var Ax, Ay: Integer): Boolean;
    Var
      TPA, TPA2: TPointArray;
    Var
      I, CTS, M: Integer;
    Var
      TP: TPoint;
    Begin
      If(Not(LoggedIn))Then Exit;
      Begin
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        M := GetSystemTime;
        FindColorsTolerance(TPA2, 5987683, MSX1, MSY1, MSX2, MSY2, 10);
        For I := 0 To GetArrayLength(TPA2) - 1 Do
        Begin
          TP := TPA2[i];
          FindColorsTolerance(TPA, 5987683, TP.x - 15, TP.y - 15, TP.x + 15, TP.y + 15, 10);
          If(GetArrayLength(TPA) >= 20)Then
          Begin
            TP := MiddleTPA(TPA);
            Result := True;
            Ax := TP.x;
            Ay := TP.y;
            Break;
          End;
        End;
        ColorToleranceSpeed(CTS);
        Writeln('Found anvil in '+IntToStr(GetSystemTime - M));
      End;
    End;

    Function FastFindVarrockFountain(Var Fx, Fy: Integer): Boolean;
    Var
      X, Y, I, C, CTS, M: Integer;
    Var
      TPA: TPointArray;
    Var
      TP: TPoint;
    Begin
      If(Not(LoggedIn))Then Exit;
      Begin
        CTS := GetColorToleranceSpeed;
        ColorToleranceSpeed(2);
        M := GetSystemTime;
        FindColorTolerance(X, Y, 9405792, MSX1, MSY1, MSX2, MSY2, 10);
        FindColorsTolerance(TPA, 9405792, X - 20, Y - 20, X + 20, Y + 20, 10);
        If(Not(GetArrayLength(TPA) >= 100))Then Exit;
        Begin
          TP := MiddleTPA(TPA);
          Fx := TP.x;
          Fy := TP.y;
          Result := True;
        End;
        ColorToleranceSpeed(CTS);
        Writeln('Found fountain in '+IntToStr(GetSystemTime - M));
      End;
    End;

    Enjoy

    You are free to use them, but only if you credit me.

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

    Default

    be cool, and explain it line by line and then i can learn somthing from it
    pls please i beg you!
    ~Hermen

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

    Default

    Hmm... Very Nice!

  4. #4
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    SCAR Code:
    TP := MiddleTPA(TPA);
            Result := True;
            Ax := TP.x;
            Ay := TP.y;

    >>

    SCAR Code:
    Result := MiddleTPAEx(TPA, Ax, Ay);

    And do you actually try if CTS 2 is the best comparision method, or do you just hope it's better?
    Hup Holland Hup!

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

    Default

    Nice! JW, why was SRL down? Was JagSex DOSing us?


    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!

  6. #6
    Join Date
    Jun 2007
    Location
    NSW, Australia.
    Posts
    541
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Probably
    Quote Originally Posted by RAM View Post
    I sam sofa king wee todd did ! ~RAM
    My SRL Army Blog.


  7. #7
    Join Date
    Apr 2007
    Location
    Finland
    Posts
    938
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  8. #8
    Join Date
    Mar 2007
    Location
    Netherlands->Amersfoort.
    Posts
    1,615
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    they look nice .

    while reading that i learned a little but more about TPA etc. thank you .

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

    Default

    man i am still sooooooooooooooooo confused about hsl and rgb and a little bit tpa :s
    ~Hermen

  10. #10
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    And do you actually try if CTS 2 is the best comparision method, or do you just hope it's better?
    None, I KNOW that it is better

  11. #11
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    I created a almost identical function, But for a range.

    -GJ!

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  12. #12
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Hehe thanks...

    Btw, Smithing.scar doesnt have an Anvil finder - *pick mine, pick mine *

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Two Math Functions I made.
    By Sandstorm in forum Research & Development Lounge
    Replies: 30
    Last Post: 01-21-2009, 03:52 PM
  2. Couple Functions I've made [IsMultiple, ReverseString, FormatNumber]
    By deathbyvirus in forum Research & Development Lounge
    Replies: 4
    Last Post: 08-06-2008, 10:56 PM
  3. I just made this sig
    By YoHoJo in forum Semi Stupid Pictures
    Replies: 8
    Last Post: 06-11-2006, 09:55 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
  •