Results 1 to 23 of 23

Thread: LoveAdvancedObjectFinder

  1. #1
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default LoveAdvancedObjectFinder

    This is my object finder, it is pretty advanced.
    There are only 2 parameters however, 1 a integer array which contains all the
    colors you want it to search for(1 is alright aswell) and the second is a string which contains all the different options you want to use separated by a comma and the last one has a semicolon.
    the following commands are available atm:

    Settings
    dev - prints time it took to find the objects and saves/shows a picture of here it found different groups.
    huemod/satmod(e.g. huemod:0.2,) - sets hue or satmod to given value
    tol (e.g. tol:10,) - sets tolerance to given value
    maxdistance (e.g. maxdistance:10,) - how far away a point can be from the group to still belong to it
    AccA/AccB( e.g. AccA:10,) - accurecy, shouldnt really be used unless you find objects that are like 25% of the main screen, AccA will exclude all points that are within the range you specify and AccB will only include every x point, so AccB:10, would only include every tenth point.

    Remove
    RemoveDensity( e.g. RemoveDensity<0.5,) - this 'draws' a box around the outer points of a group and returns how much of that box is a found point(so if you have a box of 10 pixels and 5 pixels of that were found it would have a density of 0.5) you can use both < and > to specify what you want to remove
    RemoveDistance( e.g. RemoveDistance>10,) - does the same as density but then with distance from the middle of the screen
    RemoveAmount( e.g. RemoveAmount<10) does the same as density and distance but checks for the size of a group

    Rearrange
    You can rearrange the array of groups to distance,size,density both from small to large after what you want to rearrange you put true for large to small and false for small to large so DensityTrue would mean rearrange the array from large to small density, this is important in the next step where it will check all the groups(in order) for uptext

    TheClicking
    you can use clickleft and clickright, both will check all groups for the given uptext(it will click what you specified once it found one with the correct uptext obviously) e.g. ClickRight:mine would move its mouse to the middle of all groups and check for the uptext mine, if that uptext is found it will right click


    A good example of a string would be:
    'dev,RemoveAmount>100,DistanceTrue,ClickLeft:chop; '


    SCAR Code:
    {.include SRL/SRL.scar}
    var
    MyColorArray : Array of Integer;
    AI, BI, Color, TheBitMap: integer;



    // from mastaraymond
    Function TPointArrayToIntegerArray(ThePoints:TPointArray;ReturnX:Boolean): TIntegerArray;
    var
      I:integer;
    begin;
      Try
      SetArrayLength(Result,Length(ThePoints));
      For I:= 0  to Length(ThePoints)-1 do
        If ReturnX then Result[i]:=ThePoints[i].x
        else Result[i]:=ThePoints[i].y;
      Except
      Writeln('There is an error, sorry!');
      end;
    end;


    Function Density(A : TPointArray) : Extended;
      var
        B, C : Array of Integer;
        D, E : Integer;
      Begin
        B := TPointArrayToIntegerArray(A, True);
        C := TPointArrayToIntegerArray(A, False);
        BubbleSort(B);
        BubbleSort(C);
        D := GetArrayLength(A);
        E := (B[D - 1] - B[0] + 1)*(C[D - 1] - C[0] + 1)
        Result := 1 / (E / D);
      end;

    Function RemoveSmallDensityGroups(A :TPointArrayArray; WhatDensity: Extended) : TPointArrayArray;
      var
        RV, I: Integer;
      begin
        RV := 0;
        For I := 0 To Length(A) - 1 do
          Begin
            If Density(A[i]) > WhatDensity then
              begin
                RV := RV + 1;
                SetLength(Result, RV);
                Result[RV - 1] := A[i];
              end;
          end;
      end;

    Function RemoveBigDensityGroups(A : TPointArrayArray; WhatDensity: extended) : TPointArrayArray;
      var
        RV, I: Integer;
      begin
        RV := 0;
        For I := 0 To Length(A) - 1 do
          Begin
            If Density(A[i]) < WhatDensity then
              begin
                RV := RV + 1;
                SetLength(Result, RV);
                Result[RV - 1] := A[i];
              end;
          end;
      end;


    Function WhatIsDistance(a :TPointArray) : integer;
    var
      X, Y : integer;
    begin
      FindMiddle(X, Y, A);
      Result := Distance(X, Y, 259, 144);
    end;

    //rearrange procedures thanks to wizzup
    Procedure SwapA(var a, b :TPointArray);

    Var
       c: TPointArray;
    Begin
      c := a;
      a := b;
      b := c;
    End;


    Procedure RearrangeArrayByDensity(var a: Array Of TPointArray; Small: Boolean);

    Var
       B: Boolean;
       I: Integer;
       L: extended;
    Begin
      B := True;
      L := GetArrayLength(a);
      While B Do
      Begin
        B := False;
        For I := 0 To L - 2 Do
          If Small Then
          Begin
          If Density(a[i]) > Density(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End
          Else
          Begin
            If Density(a[i]) < Density(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End;
      End;
    End;

    Procedure RearrangeArrayByDistance(var a: Array Of TPointArray; Small: Boolean);

    Var
       B: Boolean;
       L, I: Integer;
    Begin
      B := True;
      L := GetArrayLength(a);
      While B Do
      Begin
        B := False;
        For I := 0 To L - 2 Do
          If Small Then
          Begin
          If WhatIsDistance(a[i]) > WhatIsDistance(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End
          Else
          Begin
            If WhatIsDistance(a[i]) < WhatIsDistance(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End;
      End;
    End;

    Procedure RearrangeArrayByLength(var a: Array Of TPointArray; Small: Boolean);

    Var
       B: Boolean;
       L, I: Integer;

    Begin
      B := True;
      L := GetArrayLength(a);
      While B Do
      Begin
        B := False;
        For I := 0 To L - 2 Do
          If Small Then
          Begin
          If GetArrayLength(a[i]) > GetArrayLength(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End
          Else
          Begin
            If GetArrayLength(a[i]) < GetArrayLength(a[i+1]) then
            Begin
              SwapA(a[i], a[i + 1]);
              B := True;
            End
          End;
      End;
    End;

    Function Checkall(A : TPointArrayArray; UpText: String;  Left : boolean) : boolean;
    var
    I, X, Y : integer;
    begin
      For I := 0 to Length(A) - 1 do
        begin
          FindMiddle(X, Y, A[i]);
          MMouse(X, Y, 0, 0);
          Wait(50 + Random(25));
          If IsUpText(UpText) then
            begin
              Mouse(X, Y, 0, 0, Left);
              Result := True;
              Exit;
            end;
        end;
    end;

      Function LoveObjectFinder(Colors : Array of Integer; Sort : String) : Boolean;
        Var
          Dev : Boolean;
          I, A,Tol, MaxDist, AccA, AccB, TempI, ColorMarker, FindGroupsMarker: Integer;
          HueMod, SatMod : extended;
          SplittedText : Array of String;
          FoundPoints, FoundPoints2 : TPointArray;
          TwoDArrayOfTPoints: array of TPointArray;
        Begin
          HueMod := 0.2;
          SatMod := 0.2;
          Tol := 15;
          MaxDist := 5;
          AccA := 0;
          AccB := 1;
          SplittedText := SplitText(Sort);
          For I := 0 to GetArrayLength(SplittedText) - 1 do
            Case LowerCase(GetLetters(SplittedText[i])) of
              'huemod'   : HueMod  := StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1);
              'satmod'   : SatMod  := StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1);
              'tol'      : Tol     := StrToInt(GetNumbers(SplittedText[i]));
              'maxdist'  : MaxDist := StrToInt(GetNumbers(SplittedText[i]));
              'acca'     : AccA    := StrToInt(GetNumbers(SplittedText[i]));
              'accb'     : AccB    := StrToInt(GetNumbers(SplittedText[i]));
              'dev'      : Dev     := True;
            end;
          If AccA > MaxDist then
            begin
              TempI := AccA;
              AccA := MaxDist;
              MaxDist := TempI;
            end;
          ColorToleranceSpeed(2);
          SetColorspeed2Modifiers(HueMod, SatMod);
          If dev then TheBitmap := BitMapFromString(MSX2 - MSX1, MSY2 - MSY1, '');
          If dev then CopyClientToBitmap(TheBitMap, MSX1, MSY1, MSX2, MSY2);
          if dev then ColorMarker:= GetTimeRunning;
          For A := 0 to GetArrayLength(Colors) - 1 do
            begin
              FindColorsSpiralTolerance(259, 144, FoundPoints2, Colors[A], MSX1, MSY1, MSX2, MSY2, Tol);
              AddTPointArray(FoundPoints, FoundPoints2);
            end;
          if dev then WriteLn('Colorfinding took: ' + IntToStr(GetTimeRunning - ColorMarker) + 'ms.');
          if dev then FindGroupsMarker := GetTimeRunning;
          TwoDArrayOfTPoints := FindGroups(FoundPoints, MaxDist, AccA, AccB);
          if dev then WriteLn('FindGroups took: ' + IntToStr(GetTimeRunning - FindGroupsMarker) + 'ms.');
          If GetArrayLength(TwoDArrayOfTPoints) = 0 then Exit;
          For I := 0 to GetArrayLength(SplittedText) - 1 do
            begin
              If LowerCase(GetLetters(SplittedText[i])) = 'removedensity' then
                Begin
                  If Copy(SplittedText[i], 14, 1) = '<' then
                    TwoDArrayOfTPoints := RemoveSmallDensityGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1));
                  If Copy(SplittedText[i], 14, 1) = '>' then
                    TwoDArrayOfTPoints := RemoveBigDensityGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1));
                end;
              If LowerCase(GetLetters(SplittedText[i])) = 'removeamount' then
                Begin
                  If Copy(SplittedText[i], 13, 1) = '<' then
                    TwoDArrayOfTPoints := RemoveSmallPointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
                  If Copy(SplittedText[i], 13, 1) = '>' then
                    TwoDArrayOfTPoints := RemoveBigPointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
                end;
              If LowerCase(GetLetters(SplittedText[i])) = 'removedistance' then
                Begin
                  If Copy(SplittedText[i], 15, 1) = '<' then
                    TwoDArrayOfTPoints := RemoveLowerDistancePointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
                  If Copy(SplittedText[i], 15, 1) = '>' then
                    TwoDArrayOfTPoints := RemoveHigherDistancePointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
                end;
              Case LowerCase(SplittedText[i]) of
                'lengthtrue'     : RearrangeArrayByLength(TwoDArrayOfTPoints,True);
                'distancetrue'   : ReArrangeArrayByDistance(TwoDArrayOfTPoints,True);
                'densitytrue'    : ReArrangeArrayByDensity(TwoDArrayOfTPoints,True);
                'lengthfalse'    : RearrangeArrayByLength(TwoDArrayOfTPoints,False);
                'distancefalse'  : ReArrangeArrayByDistance(TwoDArrayOfTPoints,False);
                'densityfalse'   : ReArrangeArrayByDensity(TwoDArrayOfTPoints,False);
                end;
            end;
          For I := 0 to GetArrayLength(SplittedText) - 1 do
            begin
              If LowerCase(Copy(SplittedText[i], 1, 9)) = 'clickleft' then
                begin
                  Delete(SplittedText[i], 1, 9);
                  Result := CheckAll(TwoDArrayOfTPoints, LowerCase(GetLetters(SplittedText[i])), True);
                end;
              If LowerCase(Copy(SplittedText[i], 1, 10)) = 'clickright' then
                begin
                  Delete(SplittedText[i], 1, 10);
                  Result := CheckAll(TwoDArrayOfTPoints, LowerCase(GetLetters(SplittedText[i])), False);
                end;
            end;
          Result := True;
          If dev then
            Begin
              For AI := 0 To GetArrayLength(TwoDArrayOfTPoints) - 1 do
                begin
                  Color := Round((16581375/GetArrayLength(TwoDArrayOfTPoints)) * (AI + 1));
                  For BI := 0 to GetArrayLength(TwoDArrayOfTPoints[AI]) - 1 do
                    FastSetPixel(TheBitMap, TwoDArrayOfTPoints[AI][BI].x - MSX1, TwoDArrayOfTPoints[AI][BI].y - MSY1, Color);
                end;
              SaveBitmap(TheBitmap, 'c:\TheBitmap.bmp');
              DisplayDebugImgWindow(MSX2 - MSX1, MSY2 - MSY1);
              SafeDrawBitmap(TheBitmap, GetDebugCanvas, 0, 0);
            end;
        end;

    begin
      ActivateClient;
      Wait(1000);
      SetArrayLength(MyColorArray, 1);
      MyColorArray[0] := 1977645;
      LoveObjectFinder(MyColorArray, 'dev,ClickRight:ine;');
    end.

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

    Default

    Looks realy nice!

    offtopic: gratz on 500 post.

  3. #3
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    no one else interrested in this stuff?
    Infractions, reputation, reflection, the dark side of scripting, they are.

  4. #4
    Join Date
    Apr 2006
    Location
    I live in NH
    Posts
    611
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)
    Nice functions man! But dude, this needs formatting! Fixed...

    SCAR Code:
    // functions by iloveit8
    // formatted by Ron

    {.include SRL/SRL.scar}

    var
      MyColorArray : Array of Integer;

    procedure FindMiddle(var X, Y : integer; A : Array of Tpoint);
    var
      I, n : integer;
    begin
      X := 0;
      Y := 0;
      for I := 0 to GetArrayLength(A) - 1 do
      begin
        X := A[i].X + X;
        Y := A[i].Y + Y;
      end;
      X := Round(X / GetArrayLength(A));
      Y := Round(Y / GetArrayLength(A));
    end;
     
    function ClosestGroup(A : Array of Array of TPoint) : Array of TPoint;
    var
      B, I, X, Y : Integer;
    begin
      FindMiddle(X, Y, A[0]);
      B := Distance(X, Y, 259, 144);
      for I := 1 to GetArrayLength(A) - 1 do
        if (Abs(X - 259) < B) and (Abs(Y - 144) < B) then
        begin
          FindMiddle(X, Y, A[i]);
          B := Distance(X, Y, 259, 144);
          Result := A[i];
        end;
    end;
     
    function FurthestGroup(A : Array of Array of TPoint) : Array of TPoint;
    var
      B, I, X, Y : Integer;
    begin
      B := 0;
      for I := 0 to GetArrayLength(A) - 1 do
        if (Abs(X - 259) > B) and (Abs(Y - 144) > B) then
        begin
          FindMiddle(X, Y, A[i]);
          B := Distance(X, Y, 259, 144);
          Result := A[i];
        end;
    end;
     
    function RemoveLowerDistancePointGroups(A : Array of Array of TPoint; Distance: integer) : Array Of Array Of TPoint;
    var
      RV, I, X, Y: Integer;
    begin
      RV := 0;
      for I := 0 To GetArrayLength(A) do
      begin
        FindMiddle(X, Y, A[i]);
        if (Abs(X - 259) > Distance) and (Abs(Y - 144) > Distance) then
        begin
          RV := RV + 1;
          SetArrayLength(Result, RV);
          Result[RV - 1] := A[i];
        end;
      end;
    end;
     
    function RemoveHigherDistancePointGroups(A : Array of Array of TPoint; Distance: integer) : Array Of Array Of TPoint;
    var
      RV, I, X, Y: Integer;
    begin
      RV := 0;
      for I := 0 To GetArrayLength(A) do
      begin
        FindMiddle(X, Y, A[i]);
        if (Abs(X - 259) < Distance) and (Abs(Y - 144) < Distance) then
        begin
          RV := RV + 1;
          SetArrayLength(Result, RV);
          Result[RV - 1] := A[i];
        end;
      end;
    end;

    function SplitText(A : String) : Array of String;
    var
      LastLetter, I : Integer;
    begin
      LastLetter := 1;
      SetArrayLength(Result, 0);
      for I := 1 to Length(A) do
      if (A[i] = ',') or (A[i] = ';') then
      begin
        SetArrayLength(Result, GetArrayLength(Result) + 1);
        Result[GetArrayLength(Result) - 1] := Copy(A, LastLetter, I - LastLetter);
        LastLetter := I + 1;
      end;
    end;
     
    procedure ClickGroup(A : Array of TPoint; Left : boolean);
    var
      X, Y: integer;
    begin
      FindMiddle(X, Y, A);
      Mouse(X, Y, 2, 2, Left);
    end;

    function BiggestGroup(A : Array of Array of TPoint) : Array of TPoint;
    var
      B, I : Integer;
    begin
      B := 0
      for I := 0 to GetArrayLength(A) - 1 do
        if GetArrayLength(A[i]) > B then
        begin
          B := GetArrayLength(A[i]);
          Result := A[i];
        end;
    end;
     
    function SmallestGroup(A : Array of Array of TPoint) : Array of TPoint;
    var
      B, I : Integer;
    begin
      B := GetArrayLength(A[0]);
      for I := 1 to GetArrayLength(A) - 1 do
        if GetArrayLength(A[i]) < B then
        begin
          B := GetArrayLength(A[i]);
          Result := A[i];
        end;
    end;
     
    function RemoveBigPointGroups(A : Array of Array of TPoint; HowBig : integer): Array of Array of TPoint;
    var
      RV, I : Integer;
    begin
      RV := 0;
      for I := 0 to GetArrayLength(A) - 1 do
      if GetArrayLength(A[i]) <= HowBig then
      begin
        RV := RV + 1;
        SetArrayLength(Result, RV);
        Result[RV - 1] := A[i];
      end;
    end;
     
    function RemoveSmallPointGroups(A : Array of Array of TPoint; HowSmall : integer): Array of Array of TPoint;
    var
      RV, I : Integer;
    begin
      RV := 0;
      for I := 0 to GetArrayLength(A) - 1 do
        if GetArrayLength(A[i]) >= HowSmall then
        begin
          RV := RV + 1;
          SetArrayLength(Result, RV);
          Result[RV - 1] := A[i];
        end;
    end;
     
    procedure AddTPointArray(var Array1 : Array Of TPoint; Array2 : array of TPoint );
    var
      I, I2 : Integer;
    begin
      I2 := GetArrayLength(Array1);
      SetArrayLength(Array1, GetArrayLength(Array1) + GetArrayLength(Array2));
      if GetArrayLength(Array2) <> 0 then
        for I := 0 to GetArrayLength(Array2) - 1 do
          Array1[I + I2] := Array2[i];
    end;
     
    function IsWithinRangeTPointArray(A : array of TPoint; ALength: integer; D : Integer; B: TPoint) : boolean;
    var
      I : integer;
    begin
      for I := ALength - 1 downto 0 do
        if (Abs(B.x - A[i].x) <= D) And (Abs(B.y - A[i].y) <= D) then //Wizzup? ty:)
        begin
          Result := True;
          exit;
        end;
    end;
     
    function IsTPointInArray(A : Array of TPoint; B : TPoint; ALength : integer): Boolean;
    var
      I : integer;
    begin
      for I := 0 To ALength - 1 do
        if (A[i].X = B.X) and (A[i].Y = B.Y) then
        begin
          Result := True;
          Exit;
        end;
    end;

    function SubstractTPointArray(var ALength : integer; A, B: Array of TPoint; BLength: integer) : Array of TPoint;//A - B
    var
      I, Resultvariable : Integer;
    begin
      Resultvariable := 0;
      SetArrayLength(Result, 0);
      for I := 0 To ALength - 1 do
        if Not IsTPointInArray(B, A[i], BLength) then
        begin
          Resultvariable := Resultvariable + 1;
          SetArrayLength(Result, Resultvariable);
          Result[Resultvariable - 1] := A[i];
        end;
      ALength := Resultvariable;
    end;
     
    procedure SpeedItUpWithAccuracy(var A : Array Of TPoint; Acc, Acc2: integer);
    var
      Tempvariable, I : integer;
      Temp: Array of TPoint;
    begin
      Tempvariable := 0;
      SetArrayLength(Temp, 0);
      for I := 0 to GetArrayLength(A) - 1 do
        if I mod Acc2 = 0 then
          if not IsWithinRangeTPointArray(Temp, Tempvariable, Acc, A[i]) then
          begin
            Tempvariable := Tempvariable + 1;
            SetArrayLength(Temp, Tempvariable);
            Temp[Tempvariable - 1] := A[i];
          end;
      A := Temp;
    end;
     
    function FindGroups(WhichPoints : Array Of TPoint; MaxDistance, Accuracy, Accuracy2 : Integer) : Array of Array of TPoint;
    var
      I, Resultvariable, TempResultvariable, WhichPointsvariable: Integer;
    begin
      SetArrayLength(Result, 0);
      Resultvariable := 0;
      SpeedItUpWithAccuracy(WhichPoints, Accuracy, Accuracy2);
      if GetArrayLength(WhichPoints) = 0 then exit;
        repeat
          WhichPointsvariable := GetArrayLength(WhichPoints);
          Resultvariable := Resultvariable + 1;
          SetArrayLength(Result, Resultvariable);
          TempResultvariable := 1;
          SetArrayLength(Result[Resultvariable - 1], 1);
          Result[Resultvariable - 1][0] := WhichPoints[0];
          for I := 1 to WhichPointsvariable - 1 do
          begin
            if IsWithinRangeTPointArray(Result[Resultvariable - 1], TempResultvariable, MaxDistance, WhichPoints[i]) then
            begin
              TempResultvariable := TempResultvariable + 1;
              SetArrayLength(Result[Resultvariable - 1], TempResultvariable);
              Result[Resultvariable - 1][TempResultvariable - 1] := WhichPoints[i];
            end;
          end;
          WhichPoints := SubstractTPointArray(WhichPointsvariable, WhichPoints, Result[Resultvariable - 1], TempResultvariable);
        until(GetArrayLength(WhichPoints) = 0);
    end;
     
    function LoveObjectFinder(Colors : Array of Integer; Sort : String) : Boolean;
    var
      WWC, WWC2, Dev : Boolean;
      I, A,Tol, MaxDist, AccA, AccB, TempI, ColorMarker, FindGroupsMarker : Integer;
      HueMod, SatMod : extended;
      SplittedText : Array of String;
      FoundPoints, FoundPoints2 ,FinalGroup : array of TPoint;
      TwoDArrayOfTPoints: array of array of TPoint;
    begin
      HueMod := 0.2;
      SatMod := 0.2;
      Tol := 10;
      MaxDist := 10;
      AccA := 5;
      AccB := 50;
      SplittedText := SplitText(Sort);
      for I := 0 To GetArrayLength(SplittedText) - 1 do
        if (LowerCase(GetLetters(SplittedText[i])) = 'biggest') or (LowerCase(GetLetters(SplittedText[i])) = 'smallest') or (LowerCase(GetLetters(SplittedText[i])) = 'closest') or (LowerCase(GetLetters(SplittedText[i])) = 'furthest') then
          WWC := True;
      if not WWC then
        Exit;
      for I := 0 To GetArrayLength(SplittedText) - 1 do
        if (LowerCase(GetLetters(SplittedText[i])) = 'clickleft') or (LowerCase(GetLetters(SplittedText[i])) = 'clickright') then
          WWC2 := True;
      if not WWC2 then
        Exit;
      for I := 0 to GetArrayLength(SplittedText) - 1 do
        Case LowerCase(GetLetters(SplittedText[i])) of
              'huemod'   : HueMod  := StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1);
              'satmod'   : SatMod  := StrToInt(GetNumbers(SplittedText[i])) div  IntPow(10,Length(GetNumbers(SplittedText[i])) - 1);
              'tol'      : Tol     := StrToInt(GetNumbers(SplittedText[i]));
              'maxdist'  : MaxDist := StrToInt(GetNumbers(SplittedText[i]));
              'acca'     : AccA    := StrToInt(GetNumbers(SplittedText[i]));
              'accb'     : AccB    := StrToInt(GetNumbers(SplittedText[i]));
              'dev'      : Dev     := True;
            end;
      if AccA > MaxDist then
      begin
        TempI := AccA;
        AccA := MaxDist;
        MaxDist := TempI;
      end;
      ColorToleranceSpeed(2);
      SetColorspeed2Modifiers(HueMod, SatMod);
      if dev then
        CopyClientToBitmap(TheBitMap, MSX1, MSY1, MSX2, MSY2);
      if dev then
        ColorMarker:= GetTimeRunning;
      for A := 0 to GetArrayLength(Colors) - 1 do
      begin
        FindColorsSpiralTolerance(259, 144, FoundPoints2, Colors[A], MSX1, MSY1, MSX2, MSY2, 15);
        AddTPointArray(FoundPoints, FoundPoints2);
      end;
      if dev then
        WriteLn('Colorfinding took: ' + IntToStr(GetTimeRunning - ColorMarker) + 'ms.');
      if dev then
        FindGroupsMarker := GetTimeRunning;
      TwoDArrayOfTPoints := FindGroups(FoundPoints, MaxDist, AccA, AccB);
      if dev then
        WriteLn('FindGroups took: ' + IntToStr(GetTimeRunning - FindGroupsMarker) + 'ms.');
      if GetArrayLength(TwoDArrayOfTPoints) = 0 then
        Exit;
      for I := 0 to GetArrayLength(SplittedText) - 1 do
      begin
        if GetArrayLength(TwoDArrayOfTPoints) = 0 then
          Exit;
        if GetArrayLength(FinalGroup) = 0 then
          Exit;
        if LowerCase(GetLetters(SplittedText[i])) = 'removeamount' then
        begin
          if GetOthers(SplittedText[i]) = '<' then
            RemoveSmallPointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
          if GetOthers(SplittedText[i]) = '>' then
            RemoveBigPointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
        end;
        if LowerCase(GetLetters(SplittedText[i])) = 'removedistance' then
        begin
          if GetOthers(SplittedText[i]) = '<' then
            RemoveLowerDistancePointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
          if GetOthers(SplittedText[i]) = '>' then
            RemoveHigherDistancePointGroups(TwoDArrayOfTPoints, StrToInt(GetNumbers(SplittedText[i])));
        end;
        Case LowerCase(SplittedText[i]) of
          'biggest'    : FinalGroup := BiggestGroup(TwoDArrayOfTPoints);
          'smallest'   : FinalGroup := SmallestGroup(TwoDArrayOfTPoints);
          'closest'    : FinalGroup := ClosestGroup(TwoDArrayOfTPoints);
          'furthest'   : FinalGroup := FurthestGroup(TwoDArrayOfTPoints);
          'clickleft'  : ClickGroup(FinalGroup, True);
          'clickright' : ClickGroup(FinalGroup, False);
        end;
      end;
      Result := True;
      if dev then
      begin
        for AI := 0 To GetArrayLength(TwoDArrayOfTPoints) - 1 do
        begin
          Color := Round((16581375/GetArrayLength(TwoDArrayOfTPoints)) * (I + 1));
          for BI := 0 to GetArrayLength(TwoDArrayOfTPoints[AI]) - 1 do
            FastSetPixel(TheBitMap, TwoDArrayOfTPoints[AI][BI].x - MSX1, TwoDArrayOfTPoints[AI][BI].y - MSY1, Color);
        end;
        SaveBitMap(TheBitMap,'C:/TheBitMap.bmp');
      end;
    end;
     
    begin
      ActivateClient;
      Wait(1000);
      SetArrayLength(MyColorArray, 4);
      MyColorArray[0] := 0;
      MyColorArray[1] := 0;
      MyColorArray[2] := 0;
      MyColorArray[3] := 0;
      LoveObjectFinder(MyColorArray, 'HueMod:0.2,SatMod:0.2,Tol:2,MaxDist:10,AccA:9,AccB:10,RemoveAmount<3,Biggest,ClickRight;');
    end.

    ~Ron

  5. #5
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    thanks dude
    Infractions, reputation, reflection, the dark side of scripting, they are.

  6. #6
    Join Date
    Jan 2007
    Location
    Not here
    Posts
    1,604
    Mentioned
    2 Post(s)
    Quoted
    19 Post(s)

    Default

    looking nice gratz on 500
    Sleeping...

  7. #7
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    has anyone tried using it yet?, ive tried it with furnace(advicable to put accb at 500 or something like that), trees and with new/old rocks
    Infractions, reputation, reflection, the dark side of scripting, they are.

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

    Default

    Uhber leet scar ;D But I dont kinda know what to/how to use them?

  9. #9
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    if i find some time ill write a tut on it, in the mean time ill explain it on msn^^ paul.spiering@euronet.nl
    Infractions, reputation, reflection, the dark side of scripting, they are.

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

    Default

    This looks really nice , good job ...

  11. #11
    Join Date
    Feb 2006
    Location
    L.A, USA
    Posts
    1,632
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Find Middle, looks exactly like the last lines of Wizzup's mining function.

    He's the only one that I've seen that uses average coord, instead of midpoint.

    Sorry if you didn't. <3 They look great.

  12. #12
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    1,330
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by WhiteShadow View Post
    Find Middle, looks exactly like the last lines of Wizzup's mining function.

    He's the only one that I've seen that uses average coord, instead of midpoint.

    Sorry if you didn't. <3 They look great.
    Lies lots of people use it look at my find portal things that i posted. Just cause i was bored. I was using them when me and kane (remmeber him ) were making a air crafter together. Averages are just the way of the future.

    Mind you interquartile average is much much better. Which at a quick glance you did here?

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

    Default

    Quote Originally Posted by WhiteShadow View Post
    Find Middle, looks exactly like the last lines of Wizzup's mining function.

    He's the only one that I've seen that uses average coord, instead of midpoint.

    Sorry if you didn't. <3 They look great.
    yeah lol i have used that so much.... but now i order them for least to greatest and then get the middle...

  14. #14
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    i changed most stuff and it is speedy now, check it out
    Infractions, reputation, reflection, the dark side of scripting, they are.

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

    Default

    looks great but is confusing
    [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]

  16. #16
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    SCAR Code:
    MyColorArray[0] := 3487034;
      LoveObjectFinder(MyColorArray,'AccA:1,dev,DistanceTrue,RemoveAmount<1000,ClickRight:urnace;');
    this finds the furnace
    Infractions, reputation, reflection, the dark side of scripting, they are.

  17. #17
    Join Date
    May 2007
    Posts
    468
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol, that kinda clears it up alot =/
    Originally Posted by YoHoJo
    I like hentai.

  18. #18
    Join Date
    Nov 2006
    Posts
    1,103
    Mentioned
    0 Post(s)
    Quoted
    6 Post(s)

    Default

    ok, updated some stuff, now you know how to us it
    Infractions, reputation, reflection, the dark side of scripting, they are.

  19. #19
    Join Date
    Jan 2007
    Location
    USA
    Posts
    1,782
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nice, i like the idea of adding things and seperating by commas;

    Join the fastest growing merchanting clan on the the net!

  20. #20
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Wow thats really cool! I think most people (including me :P) would need a tut on how to use it, though.

  21. #21
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    13,692
    Mentioned
    146 Post(s)
    Quoted
    130 Post(s)

    Default

    Quote Originally Posted by SKy Scripter View Post
    yeah lol i have used that so much.... but now i order them for least to greatest and then get the middle...
    I think it's a bit slower though, SCAR can handle alot of math's quickly.
    Since you have those colors, why not just use all?

    BTW: You don't need round() Ron/iloveit8...



    The best way to contact me is by email, which you can find on my website: http://wizzup.org
    I also get email notifications of private messages, though.

    Simba (on Twitter | Group on Villavu | Website | Stable/Unstable releases
    Documentation | Source | Simba Bug Tracker on Github and Villavu )


    My (Blog | Website)

  22. #22
    Join Date
    Feb 2007
    Location
    Australia
    Posts
    176
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Have you made a tut yet ? wouldnt mind using it in my scripts with credit ofcourse.

    -Currently learning script
    Marzey

  23. #23
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    i just saw the picture you posted in tara's smart color thread, it looked amazing! waiting for a tut too, it is sort of confusing

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

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
  •