Results 1 to 9 of 9

Thread: getfallyroadcolor, using L*A*B Color

  1. #1
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default getfallyroadcolor, using L*A*B Color

    Check Out these L*A*B Functions....

    L*A*B Auto Color is very cool...
    dont yell at me lol it might not work......

    SCAR Code:
    program New;
    {.include srl/srl.scar}

    procedure XYZtoLab(X, Y, Z : Extended; var L, A, B : Extended);
    begin
     try
      L := 10 * Sqrt( Y );
      A := 17.5 * ((( 1.02 * x) - y) / Sqrt( Y ));
      B := 7 * ((Y - (0.847 * Z)) / Sqrt( Y ));
     except
       Writeln('ERROR: Math ERROR');
     end;
    end;

    procedure LabToXYZ(L, A, B : Extended; var  X, Y, Z : Extended);
    begin
     try
      Y := Pow(L / 10, 2);
      X := ((A / 17.5 * L / 10) + Y) / 1.02;
      Z := -((B / 7 * L / 10) - Y) / 0.847;
      except
        Writeln('ERROR: Math ERROR');
     end;
    end;

    procedure ColorToLab(Color : Integer; var L, A, B : Extended);
    var
       X, Y, Z : Extended;
    begin
       ColortoXYZ(Color, X, Y, Z);
       XYZtoLab(X, Y, Z, L, A, B);
    end;

    function LabToColor(L, A, B : Extended) : Integer;
    var
       X, Y, Z : Extended;
    begin
       LabToXYZ(L, A, B, X, Y, Z);
      Result := XYZtoColor(X, Y, Z);
    end;





    function GetFallyRoadColor : Integer;
    var
      P : TPointArray;
      i, Color, Sx, Sy : integer;
       L, A, B : Extended;
    begin
    sx := MMCX;
    sy := MMCY;
    If (FindColorSpiralTolerance(sx, sy, 6518140, MMX1, MMY1, MMX2, MMY2, 70)) then
    If (rs_OnMinimap(sx, sy)) then
    begin
     FindColorsSpiralTolerance(sx, sy, P, 6518140, MMX1, MMY1, MMX2, MMY2, 70);
       for i := 0 to GetArrayLength(P)-1 do
       begin
          If (rs_OnMinimap(P[i].x, P[i].y)) then
          begin
              Color := GetColor(P[i].x, P[i].y);
              if (Color < 1) then Color := 1;
              ColortoLab(Color, L, A, B);
            If (B < 0.0) and (B > -8.0) and (A < 25)then
               begin
                  Result := Color;
                  Writeln('Found Fally Road Color = ' + IntToStr(Result));
                  Exit;
               end;
          end;
       end;
    end;
    end;


    begin
    SetupSRL;
    FindRS;
    ActivateClient;
    Wait(1000);
    GetFallyRoadColor;
    //Writeln(inttostr(GetBankColor));
    end.

  2. #2
    Join Date
    Nov 2006
    Location
    NSW, Australia
    Posts
    3,487
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Autocolour...

    Sweet, not sure if it'll work though because I ain't 1337 enough to...

    P.S - Catching up on post count!
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

    [CENTER][BANANA]Raymond - Oh rilie? says :Your smart[/BANANA][/CENTER]

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

    Default

    Nice, works good when the road is visible..
    But when it isn't visible it results the wrong color for me.
    Hup Holland Hup!

  4. #4
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    P.S - Catching up on post count!
    agh... i sorta got over the post count thing awhile back...


    Nice, works good when the road is visible..
    But when it isn't visible it results the wrong color for me.
    thanks, it could be fixed by getting the range of the lum.. but its ok... XD

  5. #5
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    I thought the color had to be on the screen anyways lol?

    Edit: Oops that was 1k posts, I need to make a thread.


  6. #6
    Join Date
    Jun 2006
    Location
    USA
    Posts
    428
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    [OFFTOPIC]

    Quote Originally Posted by bobarkinator
    I thought the color had to be on the screen anyways lol?

    Edit: Oops that was 1k posts, I need to make a thread.
    *finds thread*

    [/OFFTOPIC]

    Nice work, btw. What's LAB?

  7. #7
    Join Date
    Jan 2007
    Location
    Kansas
    Posts
    3,760
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Lol no thread yet, probably tonight.


  8. #8
    Join Date
    Dec 2006
    Location
    utah
    Posts
    1,427
    Mentioned
    2 Post(s)
    Quoted
    7 Post(s)

    Default

    Nice work, btw. What's LAB?
    L*A*B

    Enjoy....

  9. #9
    Join Date
    Oct 2006
    Posts
    2,297
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by SKy Scripter View Post
    L*A*B

    Enjoy....
    i don't understand that
    [QUOTE=Santa_Clause;277761]I love you too TSN :p[/QUOTE]
    [CENTER][URL="http://www.stats.srl-forums.com/sigs"][IMG]http://www.stats.srl-forums.com/sigs/1324.png[/IMG][/URL][/CENTER]

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 5
    Last Post: 07-31-2007, 07:23 PM
  2. Useing grass color as road color??????
    By ronny.m.p in forum OSR Help
    Replies: 7
    Last Post: 04-28-2007, 09:42 PM
  3. its not looking for a color.....
    By acevampire in forum OSR Help
    Replies: 7
    Last Post: 03-19-2007, 09:43 PM
  4. [COLOR="Red"]UPDATE![/COLOR] [2|14|07]
    By StK Squenc in forum RS has been updated.
    Replies: 4
    Last Post: 03-05-2007, 10:34 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •