Results 1 to 2 of 2

Thread: can some1 plz explain how this wroks too me

  1. #1
    Join Date
    Feb 2009
    Posts
    2,155
    Mentioned
    4 Post(s)
    Quoted
    42 Post(s)

    Default can some1 plz explain how this wroks too me

    ok so i was lookinga t masterkill vem and i was wondering how this part of the script works i know what i tdoes but idk how it does iit any answer would be awesome

    Code:
    function FindVarrockRoadColor2: Integer;
    var
      GC, a, l, TestColor, Red, Green, Blue : integer;
    var
      P:array of Tpoint;
    begin
      GC := 7304312;
      Flag;
      FindColorsSpiralTolerance(x, y, P, GC, MMX1, MMY1, MMX2, MMY2, 60);
      l:=GetArrayLength(P);
      for a:= 0 to l-1 do
      begin
        TestColor := GetColor(P[a].x, P[a].y);
        red := (TestColor mod 256);
        green := ((TestColor / 256) mod 256);
        blue := ((TestColor / 256) / 256);
        if Red - Blue <= 12 then if Red - Blue >= 8 then
        if Red - Green <= 6 then if Red - Green >= -1 then
        if Green - Blue <= 10 then if Green - Blue >= 4 then
        if GetColor(P[a].x + 5, P[a].y + 5) = TestColor then
        if GetColor(P[a].x + 3, P[a].y + 3) = TestColor then
        if GetColor(P[a].x, P[a].y + 5) = TestColor then
        if GetColor(P[a].x + 5, P[a].y) = TestColor then
        if GetColor(P[a].x, P[a].y + 3) = TestColor then
        if GetColor(P[a].x + 3, P[a].y) = TestColor then
        if GetColor(P[a].x + 5, P[a].y + 3) = TestColor then
        if GetColor(P[a].x + 3, P[a].y + 5) = TestColor then
        begin
          Result := TestColor;
          Exit;
        end;
      end;
      WriteLn('Could not find Varrock Road Color!');
      Result := 0;
    end;

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

    Default

    SCAR Code:
    function FindVarrockRoadColor2: Integer;
    var
      GC, a, l, TestColor, Red, Green, Blue : integer;
    var
      P:array of Tpoint;
    begin
      GC := 7304312; //Ground color I believe
      Flag; //Hopefull you know Flag.. but.. it will just wait until the Flag is gone or 30 seconds have past (I believe it's 30 seconds..)
      FindColorsSpiralTolerance(x, y, P, GC, MMX1, MMY1, MMX2, MMY2, 60); //Looks in a spiral starting from the center of the 4 points (this will start at the center of the Mini Map and it will look for color GC (determined above) with a tolerance of 60
      l:=GetArrayLength(P); //Gets the length of the array.. how many points I think..
      for a:= 0 to l-1 do //from 0 to the points minus 1 do..
      begin //this stuff..
        TestColor := GetColor(P[a].x, P[a].y); //TestColor is the point x and y..
        red := (TestColor mod 256); //mod will get the remainder of something (dividing someting..) //These are all RGB stuff for autocoloring I think?
        green := ((TestColor / 256) mod 256); //same thing                                          //These are all for RGB coloring
        blue := ((TestColor / 256) / 256); //same thing                                             //Stated above..
        if Red - Blue <= 12 then if Red - Blue >= 8 then     //a bunch of if the colors are a certain color things..
        if Red - Green <= 6 then if Red - Green >= -1 then   //a bunch of if the colors are a certain color things..
        if Green - Blue <= 10 then if Green - Blue >= 4 then //a bunch of if the colors are a certain color things..
        if GetColor(P[a].x + 5, P[a].y + 5) = TestColor then //if the points from above (from the GetArrayLength(P); + 5 on the x axis and + 5 on the y axes is the test color then..
        if GetColor(P[a].x + 3, P[a].y + 3) = TestColor then //same but +3 on the x axis and +3 on the y axis
        if GetColor(P[a].x, P[a].y + 5) = TestColor then     //all the same stuff but different points
        if GetColor(P[a].x + 5, P[a].y) = TestColor then     //all the same stuff but different points
        if GetColor(P[a].x, P[a].y + 3) = TestColor then     //all the same stuff but different points
        if GetColor(P[a].x + 3, P[a].y) = TestColor then     //all the same stuff but different points
        if GetColor(P[a].x + 5, P[a].y + 3) = TestColor then //all the same stuff but different points
        if GetColor(P[a].x + 3, P[a].y + 5) = TestColor then //all the same stuff but different points
        begin
          Result := TestColor; //"saves" the test color for later use.. like.. if(FindVarrockRoadColor2 = 1234567890)then something
          Exit; //you should know..
        end;
      end;
      WriteLn('Could not find Varrock Road Color!');
      Result := 0; //if it can't find the color, it will return 0.. so then you would use it like..
    end;           //if(FindVarrockRoadColor2 = 0)then TerminateScript;
                   //Hopefully you understand all this now :D you can just use FindVarrockRoadColor I think.. dunno if anything is wrong with it.. he just edited it slightly because he's pro at life :p

    ^^

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
  •