color.scar

Discussion in 'Archives' started by pescados666, Feb 9, 2007.

Thread Status:
Not open for further replies.
color.scar
  1. Unread #1 - Feb 9, 2007 at 5:31 PM
  2. pescados666
    Joined:
    Jan 21, 2007
    Posts:
    502
    Referrals:
    1
    Sythe Gold:
    0

    pescados666 Forum Addict
    Do Not Trade

    color.scar

    i need a working version of color.scar. every one i get doesnt work. i need to use srl scripts cuz theyre the only ones that work. im not going to pay. cuz its free. reply here. ill take link or msn.
     
  3. Unread #2 - Feb 9, 2007 at 8:47 PM
  4. doomessenger
    Joined:
    Jan 21, 2007
    Posts:
    248
    Referrals:
    0
    Sythe Gold:
    0

    doomessenger Active Member
    Banned

    color.scar

    here ya go.
    Code:
    //-----------------------------------------------------------------//
    //--               Scar Standard Resource Library                --//
    //--               » ColorFinding Routines                       --//
    //-----------------------------------------------------------------//
    
    //  » function  FindColorRightTol(var cx,cy: Integer; dacolor,ax1,ay1,ax2,ay2,tol: Integer): | by RSN
    //  » function  FindMMColor(color:integer):boolean;                                   | by Stupid3ooo
    //  » function  FindMMColorTol(color,tol:integer):boolean;                            | by Stupid3ooo
    //  » procedure ClickMMColor(color:integer);                                          | by Stupid3ooo
    //  » procedure ClickMMColorTol(color,tol:integer);                                   | by Stupid3ooo
    //  » function  FindMSColor(color:integer):boolean;                                   | by Stupid3ooo
    //  » function  FindMSColorTol(color,tol:integer):boolean;                            | by Stupid3ooo
    //  » procedure ClickMSColor(color:integer;left:boolean);                             | by Stupid3ooo
    //  » procedure ClickMSColorTol(color,tol:integer;left:boolean);                      | by Stupid3ooo
    //  » function  FindColorEllipse(var x, y: integer; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
    //  » function  FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: integer): boolean; | by BenLand100
    //  » function  FindColorAbstract(var x,y: integer; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
    //  » function  FindColorsAbstract(var Points: TPointArray; Color, Tol, x1,y1,x2,y2,x3,y3,x4,y4: integer): boolean; | by BenLand100
    //  » function  ScanForObj(Scanwidth, Scanheight, Color, Tolerance: Integer; Name, DebugName: string): Boolean | by Pplsuqbawlz
    //  » function  FindColorTolRaiser(var x, y, xe, ye, xs, ys, Color, BeginTol, EndTol: integer; Spiral: Boolean): Boolean;  | by Sdcit
    //  » function  FindSimColorBase(color, xs, ys, xe, ye, LTimes, sTol, Distance: integer): integer; | by XxKanexX
    //  » function  FindSimColor(color, xs, ys, xe, ye, tol, dist: integer; hardsearch: boolean): integer; | by XxKanexX
    //  » function  FindSimColorMany(var save: array of integer; many, color, xs, ys, xe, ye, tol, dist: integer; hardsearch: boolean): integer; | by XxKanexX
    //  » function  FindMMRoadColor: Integer; | by XxKanexX
    //  » function  FindColorFromCentre(var x, y: Integer; Cx, Cy, Color, Radius, Tol: Integer): boolean; | by XxKanexX
    //  » function  ColorDistanceTolerance(Col1, Col2, xs, ys, xe, ye, tol: Integer): Integer; // * By XxKabexX
    //  » function  ColorDistance(Col1, Col2, xs, ys, xe, ye, tol: Integer): Integer; // * By XxKabexX
    //  » procedure ClickRandomlyOnColour(Colour, x, y, xa, ya : Integer; Left : Boolean); // * By Spky
    //  » function  FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean; | by Freddy1990
    //  » function  FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean; | by Freddy1990
    //  » function  MouseColor(var x, y : Integer; color, radius, tol : Integer): Boolean; // * by Krazy_Meerkat
    //  » function  FindClosestColor(var x, y, matchingcolour : Integer; colour, xs, ys, xe, ye : Integer): Boolean; // * by Krazy_Meerkat
    //  » function  FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean; | by Freddy1990
    //  » function  FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean; | by Freddy1990
    //  » function  FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean; | by Freddy1990
    //  » function  FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean; | by Freddy1990
    //  » function  ScanMMColorExact(var x, y: Integer; color: Integer): Boolean; | by Freddy1990
    //  » function  ScanMMColorTolerance(var x, y: Integer; color, tolerance: Integer): Boolean; | by Freddy1990
    //  » procedure ClickExactMMColor(color: Integer); | by Freddy1990
    //  » procedure ClickExactMMColorTol(color, tolerance: Integer); | by Freddy1990
    //  » function  ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean; | by Freddy1990
    //  » function  ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean; | by Freddy1990
    
    {*******************************************************************************
    function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2, tol: Integer): Boolean;
    By: RsN
    Description: Same as FindColorTolerance but searches from right
    *******************************************************************************}
    
    function FindColorRightTol(var cx, cy: Integer; dacolor, ax1, ay1, ax2, ay2,
      tol: Integer): Boolean;
    var
      a, b, c, d: Integer;
      x, y: Integer;
    begin
      a := ax2 - 1;
      b := ay1;
      c := ax2;
      d := ay2;
      repeat
        if (FindColorTolerance(x, y, dacolor, a, b, c, d, tol)) then
          Result := True;
        a := a - 1;
        c := c - 1;
      until (Result) or (a <= ax1);
      if (Result) then
      begin
        cx := x;
        cy := y;
      end;
    end;
    
    {*******************************************************************************
    function FindMMColor(var x, y: Integer; color: Integer): Boolean;
    By: Stupid3ooo
    Description: Finds color on minimap
    *******************************************************************************}
    
    function FindMMColor(var x, y: Integer; color: Integer): Boolean;
      // by Stupid3ooo
    begin
      if (FindColor(x, y, color, 573, 8, 723, 158)) then
        Result := True;
    end;
    
    {*******************************************************************************
    function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
    By: Stupid3ooo
    Description: Finds color on Minimap with tolerance
    *******************************************************************************}
    
    function FindMMColorTol(var x, y: Integer; color, tol: Integer): Boolean;
    begin
      if (FindColorTolerance(x, y, color, 573, 8, 723, 158, tol)) then
        Result := True;
    end;
    
    {*******************************************************************************
    function FindMiniColor(var x, y: Integer; Color, Tol: Integer; Spiral: Boolean): Boolean;
    By: Mutant Squirrle
    Description: Finds color on Minimap: Spiral or Cubic (with tolerance)
    *******************************************************************************}
    
    function FindMiniColor(var x, y: Integer; Color, tol: Integer; Spiral: Boolean):
      Boolean;
    begin
      if (not (Spiral)) then
        Result := FindColorTolerance(x, y, Color, 570, 10, 720, 160, tol)
          if (Spiral) then
          Result := FindColorSpiralTolerance(x, y, Color, 570, 10, 720, 160, tol)
    end;
    
    {*******************************************************************************
    function FindMainColor(var x, y: Integer; Color, Tol: Integer; Spiral: Boolean): Boolean;
    By: Mutant Squirrle
    Description: Finds color on Main Screen: Spiral or Cubic with (tolerance)
    *******************************************************************************}
    
    function FindMainColor(var x, y: Integer; Color, tol: Integer; Spiral: Boolean):
      Boolean;
    begin
      if (not (Spiral)) then
        Result := FindColorTolerance(x, y, Color, 3, 3, 515, 336, tol)
          if (Spiral) then
          Result := FindColorSpiralTolerance(x, y, Color, 3, 3, 515, 336, tol)
    end;
    
    {*******************************************************************************
    procedure ClickMMColor(color: Integer);
    By: Stupid3ooo
    Description: Clicks color on Minimap
    *******************************************************************************}
    
    procedure ClickMMColor(color: Integer);
    var
      x, y: Integer;
    begin
      if (FindColor(x, y, color, 573, 8, 723, 158)) then
        Mouse(x, y, 0, 0, True);
    end;
    
    {*******************************************************************************
    procedure ClickMMColorTol(color, tol: Integer);
    By: Stupid3ooo
    Description: Clicks Color on Minimap with tolerances
    *******************************************************************************}
    
    procedure ClickMMColorTol(color, tol: Integer); // by Stupid3ooo
    var
      x, y: Integer;
    begin
      if (FindColorTolerance(x, y, color, 573, 8, 723, 158, tol)) then
        Mouse(x, y, 0, 0, True);
    end;
    
    {*******************************************************************************
    function FindMSColor(var x, y: Integer; color: Integer): Boolean;
    By: Stupid3ooo
    Description: Finds color on MainScreen.
    *******************************************************************************}
    
    function FindMSColor(var x, y: Integer; color: Integer): Boolean;
    begin
      if (FindColor(x, y, color, 3, 3, 515, 338)) then
        Result := True;
    end;
    
    {*******************************************************************************
    function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
    By: Stupid3ooo
    Description: Finds color on Main Screen with tolerance.
    *******************************************************************************}
    
    function FindMSColorTol(var x, y: Integer; color, tol: Integer): Boolean;
    begin
      if (FindColorTolerance(x, y, color, 3, 3, 515, 338, tol)) then
        Result := True;
    end;
    
    {*******************************************************************************
    procedure ClickMSColor(color: Integer; left: Boolean);
    By: Stupid3ooo
    Description: Clicks color on mainscreen
    *******************************************************************************}
    
    procedure ClickMSColor(color: Integer; left: Boolean);
    var
      x, y: Integer;
    begin
      if (FindColor(x, y, color, 3, 3, 515, 338)) then
        Mouse(x, y, 0, 0, left);
    end;
    
    {*******************************************************************************
    procedure ClickMSColorTol(color, tol: Integer; left: Boolean);
    By: Stupid3ooo
    Description: Clicks Color on MainScreen with Tolerance
    *******************************************************************************}
    
    procedure ClickMSColorTol(color, tol: Integer; left: Boolean);
    var
      x, y: Integer;
    begin
      if (FindColorTolerance(x, y, color, 3, 3, 515, 338, tol)) then
        Mouse(x, y, 0, 0, left);
    end;
    
    {*******************************************************************************
    function FindColorEllipse(var x, y: Integer; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
    By: BenLand100
    Description: Searches only in the given ellipse for a color with tol, returns true if found and position in x, y
    Set Ellips Bounds according to the diagram:
             y1
        +----------+
        |          |
        | Ellipse  |
     x1 | Bounds   | x2
        |          |
        +----------+
             y2
    *******************************************************************************}
    
    function FindColorEllipse(var x, y: Integer; Color, tol, X1, Y1, X2, Y2:
      Integer): Boolean;
    var
      Temp: TCanvas;
      Cx, Cy, H, W, ScreenBmp, TempBmp, Handle: Integer;
    begin
      W := Max(X1, X2) - Min(X1, X2);
      H := Max(Y1, Y2) - Min(Y1, Y2);
      Handle := GetClientWindowHandle;
      TempBmp := BitmapFromString(W, H, '');
      Temp := GetBitmapCanvas(TempBmp);
      ScreenBmp := BitmapFromString(W, H, '');
      FastDrawClear(TempBmp, -1);
      CopyClientToBitmap(ScreenBmp, X1, Y1, X2, Y2);
      CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
      Temp.Ellipse(0, 0, W, H);
      CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
      SetTransparentColor(TempBmp, 16777215);
      FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
      SetTargetBitmap(ScreenBmp);
      x := -1;
      y := -1;
      Cx := W div 2;
      Cy := H div 2;
      if FindColorSpiralTolerance(Cx, Cy, Color, 0, 0, W, H, tol) then
      begin
        x := Cx;
        y := Cy;
        Result := True;
      end;
      SetClientWindowHandle(Handle);
      FreeBitmap(TempBmp);
      FreeBitmap(ScreenBmp);
    end;
    
    {*******************************************************************************
    function FindColorsEllipse(var Points: TPointArray; Color, Tol, X1, Y1, X2, Y2: Integer): Boolean;
    By: BenLand100
    Description: Searches only in the given ellipse for every color with tol, returns true if found and the points in Points
    Set Ellips Bounds according to the diagram:
              y1
         +----------+
         |          |
         | Ellipse  |
      x1 | Bounds   | x2
         |          |
         +----------+
              y2
    *******************************************************************************}
    
    function FindColorsEllipse(var Points: TPointArray; Color, tol, X1, Y1, X2, Y2:
      Integer): Boolean;
    var
      Temp: TCanvas;
      PtTemp: TPointArray;
      H, W, ScreenBmp, TempBmp, Handle: Integer;
    begin
      W := Max(X1, X2) - Min(X1, X2);
      H := Max(Y1, Y2) - Min(Y1, Y2);
      Handle := GetClientWindowHandle;
      TempBmp := BitmapFromString(W, H, '');
      Temp := GetBitmapCanvas(TempBmp);
      ScreenBmp := BitmapFromString(W, H, '');
      FastDrawClear(TempBmp, -1);
      CopyCanvas(GetClientCanvas, GetBitmapCanvas(ScreenBmp), X1, Y1, X2, Y2, 0, 0,
        W, H);
      CopyCanvas(GetBitmapCanvas(TempBmp), Temp, 0, 0, W, H, 0, 0, W, H);
      Temp.Ellipse(0, 0, W, H);
      CopyCanvas(Temp, GetBitmapCanvas(TempBmp), 0, 0, W, H, 0, 0, W, H);
      SetTransparentColor(TempBmp, 16777215);
      FastDrawTransparent(0, 0, TempBmp, ScreenBmp);
      SetTargetBitmap(ScreenBmp);
      FindColorsSpiralTolerance(W / 2, H / 2, PtTemp, Color, 0, 0, W, H, tol);
      if GetArrayLength(PtTemp) > 0 then
      begin
        Points := PtTemp;
        Result := True;
      end;
      SetClientWindowHandle(Handle);
      FreeBitmap(TempBmp);
      FreeBitmap(ScreenBmp);
    end;
    
    {*******************************************************************************
    function FindColorAbstract(var x, y: Integer; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
    By: BenLand100
    Description: Searches in an abstract box (see Math.scar) for a color and tolerance and the first one found in x, y
    *******************************************************************************}
    
    function FindColorAbstract(var x, y: Integer; Color, tol, x1, y1, x2, y2, x3,
      y3, x4, y4: Integer): Boolean;
    var
      found: Boolean;
      Pt, CX, CY, UY, dy, rx, LX: Integer;
      Points: TPointArray;
    begin
      UY := Min(y1, y2);
      dy := Max(y3, y4);
      LX := Min(x1, x4);
      rx := Max(x2, x3);
      FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), Points, Color, LX,
        UY, rx, dy, tol);
      for pt := 0 to GetArrayLength(points) - 1 do
      begin
        if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, Points[pt].x, Points[pt].y)
          then
        begin
          found := True;
          CX := Points[pt].x;
          CY := Points[pt].y
            Break;
        end;
      end;
      x := -1
        y := -1
        if found then
      begin
        x := CX
          y := CY
          Result := True
      end;
    end;
    
    {*******************************************************************************
    function FindColorsAbstract(var Points: TPointArray; Color, Tol, x1, y1, x2, y2, x3, y3, x4, y4: Integer): Boolean;
    By: BenLand100
    Description: Searches in an abstract box (see Math.scar) for a color and tolerance and puts every instance of it in Points
    *******************************************************************************}
    
    function FindColorsAbstract(var Points: TPointArray; Color, tol, x1, y1, x2, y2,
      x3, y3, x4, y4: Integer): Boolean;
    var
      Found: Boolean;
      Pt, TempPt, UY, dy, rx, LX: Integer;
      FPoints, Temp: TPointArray;
    begin
      UY := Min(y1, y2);
      dy := Max(y3, y4);
      LX := Min(x1, x4);
      rx := Max(x2, x3);
      FindColorsSpiralTolerance(((LX + rx) / 2), ((UY + dy) / 2), FPoints, Color,
        LX, UY, rx, dy, tol);
      for pt := 0 to GetArrayLength(FPoints) - 1 do
      begin
        WriteLn(IntToStr(FPoints[pt].x) + ', ' + IntToStr(FPoints[pt].y));
        if InAbstractBox(x1, y1, x2, y2, x3, y3, x4, y4, FPoints[Pt].x,
          FPoints[Pt].y) then
        begin
          Found := True;
          SetArrayLength(Temp, GetArrayLength(Temp) - 1);
          TempPt := GetArrayLength(Temp) - 1;
          Temp[TempPt].x := FPoints[Pt].x;
          Temp[TempPt].y := FPoints[Pt].y;
        end;
      end;
      if found then Result := True
        Points := Temp;
    end;
    
    {*******************************************************************************
    function FindColorTolRaiser(x, y: Integer; xe, ye, xs, ys, Color, BeginTol, EndTol: Integer; Spiral: Boolean; TolSpeed: Integer): Boolean;
    By: Sdcit
    Description: Searches for a color with beginTol then raises tol by 1 until it equals EndTol or the color is found.
    *******************************************************************************}
    
    function FindColorTolRaiser(x, y: Integer; xe, ye, xs, ys, Color, BeginTol,
      EndTol: Integer; Spiral: Boolean; TolSpeed: Integer): Boolean;
    var
      TolCount: Integer;
    begin
      ColorToleranceSpeed(TolSpeed)
        if (Spiral) then
      begin
        for TolCount := BeginTol to EndTol do
          if (FindColorSpiralTolerance(x, y, color, xe, ye, xs, ys, TolCount)) then
          begin
            Result := True;
            Exit;
          end;
      end;
      if (not (Spiral)) then
      begin
        for TolCount := BeginTol to EndTol do
          if (FindColorTolerance(x, y, color, xe, ye, xs, ys, TolCount)) then
          begin
            Result := True;
            Exit;
          end;
      end;
    end;
    
    {*******************************************************************************
    function ScanForObjectMulti(var x, y: Integer; Scanwidth, Scanheight, Color, Color2, Color3, Tolerence: Integer; Name: String): Boolean;
    By: Renax
    Description: like findobj
    *******************************************************************************}
    
    function ScanForObjectMulti(var x, y: Integer; Scanwidth, Scanheight, Color,
      Color2, Color3, Tolerence: Integer; Name: string): Boolean;
    var
      a, b, c, d, e, f: Integer;
      Addx, Addy, Switch: Integer;
      Change, Forwardx, Forwardy, Which: Boolean;
    begin
      Change := False;
      Which := False
        Forwardx := True;
      Forwardy := True;
      a := 516 / Scanwidth;
      b := 338 / Scanheight;
      c := Trunc(a / 2);
      d := Trunc(b / 2);
      e := 0;
      f := 0;
      Addx := 1;
      Addy := 1;
      Switch := 1;
      repeat
        if (FindColorTolerance(x, y, Color, (258 + e * Scanwidth), (169 + f *
          Scanheight), (258 + e * Scanwidth + Scanwidth), (169 + f * Scanheight +
          Scanheight), Tolerence)) then
          MMouse(x, y, 5, 5)
        else
          if (FindColorTolerance(x, y, Color2, (258 + e * Scanwidth), (169 + f *
            Scanheight), (258 + e * Scanwidth + Scanwidth), (169 + f * Scanheight +
            Scanheight), Tolerence)) then
            MMouse(x, y, 5, 5)
          else
            if (FindColorTolerance(x, y, Color3, (258 + e * Scanwidth), (169 + f *
              Scanheight), (258 + e * Scanwidth + Scanwidth), (169 + f * Scanheight
                +
              Scanheight), Tolerence)) then
              MMouse(x, y, 5, 5);
        if (IsUpText(Name)) then
        begin
          Result := True;
          Break;
        end;
        if (Change) then
        begin
          Switch := Switch * -1;
          Addx := (Addx * -1) + Switch;
          Addy := (Addy * -1) + Switch;
          Change := False;
        end;
        if (Forwardx) and (not (Which)) then
          e := e + Switch;
        if (Forwardy) and (Which) then
          f := f + Switch;
        if (e = Addx) then
        begin
          Forwardx := False;
          Which := True;
        end;
        if (f = Addy) then
        begin
          Forwardy := False;
          Which := False;
        end;
        if (not Forwardy) and (not Forwardx) then
        begin
          Forwardy := True;
          Forwardx := True;
          Change := True;
        end;
      until ((e > c) or (f > d));
    end;
    
    {*******************************************************************************
    function FindSimColorBase(color, xs, ys, xe, ye, LTimes, sTol, Distance: Integer): Integer;
    By: XxKanexX
    Description: Used in FindSimColor function.
    *******************************************************************************}
    
    function FindSimColorBase(color, xs, ys, xe, ye, LTimes, sTol, Distance:
      Integer): Integer;
    var
      x, y, a, i, buff, tol, stimes: Integer;
    begin
      tol := sTol;
      a := 2;
      Result := -1;
      repeat
        if (FindColorTolerance(x, y, color, xs, ys, xe, ye, tol)) then
        begin
          repeat
            buff := GetColor(x + Random(a) - Random(a), y + Random(a) - Random(a));
            if (buff = -1) then
              buff := GetColor(x + (Random(a) / 2) - (Random(a) / 2), y + (Random(a)
                / 2) - (Random(a) / 2));
            if (SimilarColors(buff, color, tol)) and (not (Buff = color)) and (not
              (buff = -1)) then
            begin
              Result := Buff;
              Exit;
            end else
            begin
              i := i + 1;
              tol := tol + 2;
              a := a + 1 + Random(Distance / (Distance / 2) + Random(i));
              if (a > Distance) then
                a := 1;
            end;
          until (tol > 40 + (LTimes) + (tol / 2));
        end else
          tol := tol + 1;
        stimes := stimes + 1;
      until (tol > 40 + ((LTimes) / 2)) and (stimes > 3);
    end;
    
    {*******************************************************************************
    function FindSimColor(color, xs, ys, xe, ye, tol, dist: Integer; hardsearch: Boolean): Integer;
    By: XxKanexX
    Description: Searches for a color similar to the base color. Will result as -1 if not found.
    *******************************************************************************}
    
    function FindSimColor(color, xs, ys, xe, ye, tol, dist: Integer; hardsearch:
      Boolean): Integer;
    var
      rtol, i: Integer;
    begin
      if (tol <> -1) and (tol <> 0) then
        rtol := tol
      else
        rtol := 5;
      Result := FindSimColorBase(color, xs, ys, xe, ye, 5, rtol, dist);
      if (Result = -1) then
        Result := FindSimColorBase(color, xs, ys, xe, ye, 10, rtol + (Random(3) +
          1), dist);
      if (Result = -1) and (hardsearch) then
        for i := 1 to 3 do
        begin
          Result := FindSimColorBase(color, xs, ys, xe, ye, 10 + (5 * I), rtol +
            (Random(3) + 1), dist);
          if (Result <> -1) then
            Exit;
        end;
    end;
    
    {*******************************************************************************
    function FindSimColorMany(var save: Array of Integer; many, color, xs, ys, xe, ye, tol, dist: Integer; hardsearch: Boolean): Integer;
    By: XxKanexX
    Description: Searches for 1 - 3 colors (specified in many) and saves them into an array.
    Results in how many colors were found. All colors return different values.
    If not found, returns as -1 in the array.
    *******************************************************************************}
    
    function FindSimColorMany(var save: array of Integer; many, color, xs, ys, xe,
      ye, tol, dist: Integer; hardsearch: Boolean): Integer;
    var
      i: Integer;
    begin
      SetArrayLength(save, many + 1);
      if (Many > 3) or (Many < 1) then
        Many := 1;
      save[1] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
    
      if (many > 1) then
      begin
        repeat
          save[2] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
          i := i + 1;
          if (i > 50) then
          begin
            save[2] := -1;
            break;
          end;
        until (save[2] <> save[1]) and (save[2] <> -1);
        i := 0;
    
        if (many > 2) then
        begin
          repeat
            save[3] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
            i := i + 1;
            if (i > 50) then
            begin
              save[3] := -1;
              break;
            end;
          until (save[3] <> save[2]) and (save[3] <> save[1]) and (save[3] <> -1);
          i := 0;
        end;
      end;
    
      for i := 1 to many do
        if (not (save[i] = -1)) then
          Result := Result + 1;
    
    end;
    
    {*******************************************************************************
    function FindColorToleranceDOB(var x, y: Integer; Color1, Color2, xs, ys, xe, ye, Tolerance: Integer): Boolean;
    By: XxKanexX
    Description: Works just like "FindColorTolerance" but will search for 2 colors.
    if either one is found, will result as true.
    Used in "InFight" function.
    *******************************************************************************}
    
    function FindColorToleranceDOB(var x, y: Integer; Color1, Color2, xs, ys, xe,
      ye, Tolerance: Integer): Boolean;
    begin
      if (FindColorTolerance(x, y, Color1, xs, ys, xe, ye, Tolerance)) or
        (FindColorTolerance(x, y, Color2, xs, ys, xe, ye, Tolerance)) then
        Result := True;
    end;
    
    {*******************************************************************************
    function FindSimColorManyText(var save: Array of Integer; text: String; many, color, xs, ys, xe, ye, tol, dist: Integer; hardsearch: Boolean): Integer;
    By: XxKanexX
    Description: Searches for 1 - 3 colors (specified in many) while a certain text
    is in the 9, 9 co-ordinates and saves them into an array.
    Results in how many colors were found. All colors return different values.
    If not found, returns as -1 in the array.
    *******************************************************************************}
    
    function FindSimColorManyText(var save: array of Integer; text: string; many,
      color, xs, ys, xe, ye, tol, dist: Integer; hardsearch: Boolean): Integer;
    var
      i: Integer;
    begin
      if (not Option2(text)) then
        Exit
      else
      begin
        SetArrayLength(save, many + 1);
        if (Many > 3) or (Many < 1) then
          Many := 1;
    
        save[1] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
    
        if (many > 1) then
        begin
          repeat
            if (not Option2(text)) then
            begin
              save[2] := -1;
              break;
            end;
            save[2] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
            i := i + 1;
            if (i > 50) then
            begin
              save[2] := -1;
              break;
            end;
          until (save[2] <> save[1]) and (save[2] <> -1);
          i := 0;
    
          if (many > 2) then
          begin
            repeat
              if (not Option2(text)) then
              begin
                save[3] := -1;
                break;
              end;
              save[3] := FindSimColor(color, xs, ys, xe, ye, tol, dist, hardsearch);
              i := i + 1;
              if (i > 50) then
              begin
                save[3] := -1;
                break;
              end;
              if (not (Option2(text))) then
                Exit;
            until (save[3] <> save[2]) and (save[3] <> save[1]) and (save[3] <> -1);
            i := 0;
          end;
        end;
    
        for i := 1 to many do
          if (not (save[i] = -1)) then
            Result := Result + 1;
      end;
    end;
    
    {*******************************************************************************
    function FindMMRoadColor: Integer;
    By: XxKanexX
    Description: Finds the Minimap Road color.
    *******************************************************************************}
    
    function FindMMRoadColor: Integer;
    var
      RoadDTM, RoadDTM2, RoadDTM3, RoadDTM4, RoadDTM5, RoadDTM6: Integer;
    begin
      RoadDTM := DTMFromString('78DA632C606260C8644001C1DEDE609A11CA6' +
        '72C06AAC925A0A61AA82683809A3CA09A74DC6A80B20C002D8107' +
        '28');
      RoadDTM2 := DTMFromString('78DA639CCDC4C0E0C18002F2D2D2C0342394C' +
        'FD80754E34340CD5CA01A2F026A1610615737508D377E3500EF49' +
        '0A99');
      RoadDTM3 := DTMFromString('78DA632C61626088634001D5C545609A11CA6' +
        '7CC04AA4924A0A600A82609BF1A007DF4069B');
      RoadDTM4 := DTMFromString('78DA632C666260886340016579B9609A11CA6' +
        '7AC00AA8922A0A610A8269A809A7CC27601008CA20891');
      RoadDTM5 := DTMFromString('78DA6364626660F8C1800262C2C2C0342394C' +
        'FC80954F381801A2EA09ADF44A8F98E5F0D0073BD082E');
      RoadDTM6 := DTMFromString('78DA6364676660F065644006C9B1D1601A26C' +
        'AC80354E342400D2F508D177E3500F004045F');
      Result := FindMMColorDTMBaseDouble(RoadDTM, RoadDTM2, 4934483, 6710894, 7);
      if Result < 1 then
        Result := FindMMColorDTMBaseDouble(RoadDTM3, RoadDTM4, 7171702, 7500667, 7);
      if Result < 1 then
        Result := FindMMColorDTMBaseDouble(RoadDTM5, RoadDTM6, 5658204, 5987683, 7);
      FreeDTM(RoadDTM);
      FreeDTM(RoadDTM2);
      FreeDTM(RoadDTM3);
      FreeDTM(RoadDTM4);
      FreeDTM(RoadDTM5);
      FreeDTM(RoadDTM6);
    end;
    
    {*******************************************************************************
    function FindMMLimeRoadColor: Integer;
    By: XxKanexX
    Description:
    *******************************************************************************}
    
    function FindMMLimeRoadColor: Integer;
    var
      LimeDTM, LimeDTM2, LimeDTM3, LimeDTM4, LimeDTM5, LimeDTM6: Integer;
      i: Integer;
    begin
      LimeDTM := DTMFromString('78DA63EC66626028644001ADCDD9609A11CA6' +
        '76C07AAC926A0A607A82687809A89403505F8D50000E92709C4');
      LimeDTM2 := DTMFromString('78DA63E460666078CC8002C2031CC0342394C' +
        'FC80D54F392801A01A09A5704D4B001D53CC5AF060040E20775');
      LimeDTM3 := DTMFromString('78DA63EC60626098CB80028A7363C0342394C' +
        'F0852339D809A4EA09A8904D4B402D5CCC4AF0600E252097D');
      LimeDTM4 := DTMFromString('78DA63EC656260A8644001DD4DF9609A11CA6' +
        '7EC07AA2927424D010135DD403545F8D5000001E10A09');
      LimeDTM5 := DTMFromString('78DA637CC3C4C0F09801054CEA4A06D38C503' +
        'EE307A09A5704D47C06AA798A5F0D0063B90A0B');
      LimeDTM6 := DTMFromString('78DA6364606660086764400685C9DE601A26C' +
        'AC80854134840CD3F26826A0015EE0567');
      for i := 1 to 2 do
      begin
        Result := FindMMColorDTMBaseDouble(LimeDTM, LimeDTM2, 7046021, 6583422, 5 +
          (3 * i));
        if Result < 1 then
          Result := FindMMColorDTMBaseDouble(LimeDTM3, LimeDTM4, 60573313, 7307915, 5
            + (3 * i));
        if Result < 1 then
          Result := FindMMColorDTMBaseDouble(LimeDTM5, LimeDTM6, 6523538, 4940657, 5
            + (3 * i));
        if Result < 1 then
          Result := FindMMColorDTMBase(LimeDTM5, 6194059, 5 + (3 * i));
        if Result > 1 then
          break;
      end;
      FreeDTM(LimeDTM);
      FreeDTM(LimeDTM2);
      FreeDTM(LimeDTM3);
      FreeDTM(LimeDTM4);
      FreeDTM(LimeDTM5);
      FreeDTM(LimeDTM6);
    end;
    
    {*******************************************************************************
    function FindColorFromCentre(var x, y: Integer; Cx, Cy, Color, Radius, Tol: Integer): Boolean;
    By: XxKanexX
    Description: From the centre increases the box to find the color in up to the radius.
    *******************************************************************************}
    
    function FindColorFromCentre(var x, y: Integer; Cx, Cy, Color, Radius, tol:
      Integer): Boolean;
    var
      i: Integer;
    begin
      for i := 1 to Radius do
      begin
        if FindColorTolerance(x, y, Color, Cx - i, Cy - i, Cx + i, Cy + i, tol) then
        begin
          Result := True;
          Exit;
        end;
      end;
    end;
    
    {*******************************************************************************
    function ColorDistance(Col1, Col2, xs, ys, xe, ye: Integer): Integer;
    By: XxKanexX
    Description: Detects co-ordinates of both colors and measures the distance between each of them.
    *******************************************************************************}
    
    function ColorDistance(Col1, Col2, xs, ys, xe, ye: Integer): Integer;
    var
      a, b: Integer;
    begin
      FindColor(x, y, Col1, xs, ys, xe, ye);
      FindColor(a, b, Col2, xs, ys, xe, ye);
      Result := Distance(x, y, a, b);
    end;
    
    {*******************************************************************************
    function ColorDistanceTolerance(Col1, Col2, xs, ys, xe, ye, tol: Integer): Integer;
    By: XxKanexX
    Description: Does the same as, "ColorDistance". But the colors are searched with tolerance.
    *******************************************************************************}
    
    function ColorDistanceTolerance(Col1, Col2, xs, ys, xe, ye, tol: Integer):
      Integer;
    var
      a, b: Integer;
    begin
      FindColorTolerance(x, y, Col1, xs, ys, xe, ye, tol);
      FindColorTolerance(a, b, Col2, xs, ys, xe, ye, tol);
      Result := Distance(x, y, a, b);
    end;
    
    {*******************************************************************************
    procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
    By: Spky
    Description: Clicks randomly on the specified colour in box "x, y, xa, ya".
    *******************************************************************************}
    
    procedure ClickRandomlyOnColour(Colour, x, y, xa, ya: Integer; Left: Boolean);
    var
      Ix, Iy, I: Integer;
      Coords: array of TPoint;
    begin
      for Iy := y to ya do
        for Ix := x to xa do
          if (GetColor(Ix, Iy) = Colour) then
          begin
            SetArrayLength(Coords, GetArrayLength(Coords) + 1)
              Coords[GetArrayLength(Coords) - 1].x := Ix;
            Coords[GetArrayLength(Coords) - 1].y := Iy;
          end;
      I := 0 + Random(GetArrayLength(Coords));
      if (I > 0) then
        case Left of
          True: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
          False: Mouse(Coords[I].x, Coords[I].y, 0, 0, True);
        end;
    end;
    
    {*******************************************************************************
    function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy: Integer): Boolean;
    By: Freddy1990
    Description: Searches for a color within a circle.
    *******************************************************************************}
    
    function FindColorCircle(var x, y: Integer; color, radius, MidPointx, MidPointy:
      Integer): Boolean;
    begin
      Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy, 0);
    end;
    
    {*******************************************************************************
    function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx, MidPointy, tolerance: Integer): Boolean;
    By: Freddy1990
    Description: Searches for a color with a tolerance within a circle.
    *******************************************************************************}
    
    function FindColorCircleTolerance(var x, y: Integer; color, radius, MidPointx,
      MidPointy, tolerance: Integer): Boolean;
    begin
      Result := FindColorCircleD(x, y, color, radius, MidPointx, MidPointy,
        tolerance);
    end;
    
    {*******************************************************************************
    function MouseColor(var x, y: Integer; color, radius, tol: Integer): Boolean;
    By: Krazy_Meerkat
    Description: Searches for a color with a tolerance in a spiral around the mouse.
    *******************************************************************************}
    
    function MouseColor(var x, y: Integer; color, radius, tol: Integer): Boolean;
    var
      MousieX, MousieY: Integer;
    begin
      GetMousePos(MousieX, MousieY);
      if (FindColorSpiralTolerance(x, y, color, MousieX - radius, MousieY - radius,
        MousieX + radius, MousieY + radius, tol)) then
        Result := True;
    end;
    
    {*******************************************************************************
    function FindClosestColor(var x, y, matchingcolour: Integer; colour, xs, ys, xe, ye: Integer): Boolean;
    By: Krazy_Meerkat
    Description: Searches for a color using the least amount of tolerance possible
    *******************************************************************************}
    
    function FindClosestColor(var x, y, matchingcolour: Integer; colour, xs, ys, xe,
      ye: Integer): Boolean;
    var
      tol, range: Integer;
    begin
      tol := 100
        range := tol div 4
        repeat
        if (FindColor(x, y, colour, xs, ys, xe, ye)) then
          break;
        if (not (FindColorSpiralTolerance(x, y, colour, xs, ys, xe, ye, tol))) then
        begin
          repeat
            tol := tol + range
          until (FindColorSpiralTolerance(x, y, colour, xs, ys, xe, ye, tol))
            tol := tol - (range div 2)
            range := (range div 2)
        end;
        tol := tol - range
      until (range = 0)
        Result := True;
      matchingcolour := GetColor(x, y);
    end;
    
    {*******************************************************************************
    function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBox): Boolean;
    By: Freddy1990
    Description: Searches for a color in a square while skipping a square.
    *******************************************************************************}
    
    function FindColorSkipBox(var x, y: Integer; color, x1, y1, x2, y2: Integer;
      box: TBox): Boolean;
    var
      a, b: TPointArray;
    begin
      SetArrayLength(a, 1);
      SetArrayLength(b, 1);
      a[0] := cPoint2(box, 1);
      b[0] := cPoint2(box, 2);
      Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
    end;
    
    {*******************************************************************************
    function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBox): Boolean;
    By: Freddy1990
    Description: Searches for a color in a square while skipping a square with a tolerance.
    *******************************************************************************}
    
    function FindColorSkipBoxTolerance(var x, y: Integer; color, x1, y1, x2, y2,
      tolerance: Integer; box: TBox): Boolean;
    var
      a, b: TPointArray;
    begin
      SetArrayLength(a, 1);
      SetArrayLength(b, 1);
      a[0] := cPoint2(box, 1);
      b[0] := cPoint2(box, 2);
      Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
    end;
    
    {*******************************************************************************
    function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2: Integer; box: TBoxArray): Boolean;
    By: Freddy1990
    Description: Searches for a color in a square while skipping multiple squares.
    *******************************************************************************}
    
    function FindColorSkipBoxArray(var x, y: Integer; color, x1, y1, x2, y2:
      Integer; box: TBoxArray): Boolean;
    var
      a, b: TPointArray;
    begin
      a := cPointArray2(box, 1);
      b := cPointArray2(box, 2);
      Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, 0, a, b);
    end;
    
    {*******************************************************************************
    function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2, y2, tolerance: Integer; box: TBoxArray): Boolean;
    By: Freddy1990
    Description: Searches for a color in a square while skipping multiple squares.
    *******************************************************************************}
    
    function FindColorSkipBoxArrayTolerance(var x, y: Integer; color, x1, y1, x2,
      y2, tolerance: Integer; box: TBoxArray): Boolean;
    var
      a, b: TPointArray;
    begin
      a := cPointArray2(box, 1);
      b := cPointArray2(box, 2);
      Result := FindColorSkipBoxD(x, y, color, x1, y1, x2, y2, tolerance, a, b);
    end;
    
    {*******************************************************************************
    function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
    By: Freddy1990
    Description: Finds a color on the minimap. (minimap being 100% correct)
    *******************************************************************************}
    
    function ScanMMColorExact(var x, y: Integer; color: Integer): Boolean;
    begin
      Result := ScanExactMinimapD(x, y, color, 0);
    end;
    
    {*******************************************************************************
    function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance: Integer): Boolean;
    By: Freddy1990
    Description: Finds a color with a tolerance on the minimap. (minimap being 100% correct)
    *******************************************************************************}
    
    function ScanMMColorExactTolerance(var x, y: Integer; color, tolerance:
      Integer): Boolean;
    begin
      Result := ScanExactMinimapD(x, y, color, tolerance);
    end;
    
    {*******************************************************************************
    procedure ClickExactMMColor(color: Integer);
    By: Freddy1990
    Description: Clicks a color on the EXACT minimap
    *******************************************************************************}
    
    procedure ClickExactMMColor(color: Integer);
    var
      x, y: Integer;
    begin
      if (ScanMMColorExact(x, y, color)) then
        Mouse(x, y, 0, 0, True);
    end;
    
    {*******************************************************************************
    procedure ClickExactMMColorTol(color, tolerance: Integer);
    By: Freddy1990
    Description: Clicks a color with a tolerance on the EXACT Minimap.
    *******************************************************************************}
    
    procedure ClickExactMMColorTol(color, tolerance: Integer);
    var
      x, y: Integer;
    begin
      if (ScanMMColorExactTolerance(x, y, color, tolerance)) then
        Mouse(x, y, 0, 0, True);
    end;
    
    {*******************************************************************************
    function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color: Integer): Boolean;
    By: Freddy1990
    Description: Finds a color in the specified rectangle on the minimap. (minimap being 100% correct)
    *******************************************************************************}
    
    function ScanMMAreaColorExact(var x, y: Integer; x1, y1, x2, y2, color:
      Integer): Boolean;
    begin
      Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, 0);
    end;
    
    {*******************************************************************************
    function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color, tolerance: Integer): Boolean;
    By: Freddy1990
    Description: Finds a color in the specified rectangle with a tolerance on the minimap. (minimap being 100% correct)
    *******************************************************************************}
    
    function ScanMMAreaColorExactTolerance(var x, y: Integer; x1, y1, x2, y2, color,
      tolerance: Integer): Boolean;
    begin
      Result := ScanExactMMAreaD(x, y, x1, y1, x2, y2, color, tolerance);
    end;
    
     
  5. Unread #3 - Feb 9, 2007 at 9:32 PM
  6. pescados666
    Joined:
    Jan 21, 2007
    Posts:
    502
    Referrals:
    1
    Sythe Gold:
    0

    pescados666 Forum Addict
    Do Not Trade

    color.scar

    it still gives me a error. the findcolorcircled error. try this script and tell me if it works on urs.

     
  7. Unread #4 - Feb 10, 2007 at 8:41 PM
  8. doomessenger
    Joined:
    Jan 21, 2007
    Posts:
    248
    Referrals:
    0
    Sythe Gold:
    0

    doomessenger Active Member
    Banned

    color.scar

    if you got the "FindColorCircleD" error, that means that you did not install the plugins to the correct folder.
     
  9. Unread #5 - Feb 12, 2007 at 2:23 AM
  10. SlayerX
    Joined:
    Jan 23, 2007
    Posts:
    100
    Referrals:
    0
    Sythe Gold:
    0

    SlayerX Active Member

    color.scar

    try checking at at \c
     
  11. Unread #6 - Feb 12, 2007 at 12:23 PM
  12. doomessenger
    Joined:
    Jan 21, 2007
    Posts:
    248
    Referrals:
    0
    Sythe Gold:
    0

    doomessenger Active Member
    Banned

    color.scar

    what are you talking about??
     
< Lack of Activity | FFS... I'm sorry. >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site