Results 1 to 7 of 7

Thread: Santy Functions!

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

    Default Santy Functions!

    SCAR Code:
    function FindMouse : Boolean;
    var
      MousePoints : TPointArrayArray;
      MousePointArray : TPointArray;
      CheckPoint : TPoint;
      MouseColoursArray : TIntegerArray;
      MouseColour, StartTime, MouseTime, X, Y, I : Integer;
      CTS : Integer;
    begin
      CTS := GetColorToleranceSpeed;
      MarkTime(StartTime);
      ColorToleranceSpeed(2);
      FindColorsSpiralTolerance(MSCX, MSCY, MousePointArray, 16645629, MSX1, MSY1, MSX2, MSY2, 7);
      MousePoints := SplitTPA(MousePointArray, 5);
      for I := 0 to High(MousePoints) do
      begin
        CheckPoint := MiddleTPA(MousePoints[I]);
        MouseColour := GetColor(CheckPoint.X, CheckPoint.Y);
        MarkTime(MouseTime);
        Mouse(CheckPoint.X, CheckPoint.Y, 2, 2, False);
        Wait(50 + Random(50));
        if ClickOption('ouse', 1) then
        begin
          GetMousePos(X, Y);
          Mouse(X, Y, 0, 0, True);
          if not(InIntArray(MouseColoursArray, MouseColour)) then
          begin
            SetArrayLength(MouseColoursArray, Length(MouseColoursArray) + 1);
            MouseColoursArray[High(MouseColoursArray)] := MouseColour;
            WriteLn(IntToStr(MouseColour) + ' Added To MouseColour Array');
          end;
          Result := True;
          WriteLn(IntToStr(TimeFromMark(StartTime) - TimeFromMark(MouseTime)));
          ColorToleranceSpeed(CTS);
          Exit;
        end;
      end;
    end;

    SCAR Code:
    function FindTree : Boolean;
    var
      TreePointArray : TPointArrayArray;
      TreePoints : TPointArray;
      Centre : TPoint;
      TreeBox : TBox;
      X, Y, I, K, U : Integer;
      CTS : Integer;
    begin
      CTS := GetColorToleranceSpeed;
      MarkTime(U);
      ColorToleranceSpeed(2);
      Centre := IntToPoint(MSCX, MSCY);
      FindColorsTolerance(TreePoints, 2910042, MSX1, MSY1, MSX2, MSY2, 10);
      TreePointArray := SplitTPA(TreePoints, 20);
      SortATPAFrom(TreePointArray, Centre);
      K := TimeFromMark(U);
      for I := 0 to High(TreePointArray) do
      begin
        TreeBox := GetTPABounds(TreePointArray[I]);
        MMouse((TreeBox.X1 + TreeBox.X2)/2, (TreeBox.Y1 + TreeBox.Y2)/2, 3, 3);
        Wait(50 + Random(50));
        if IsUpText('hop') then
        begin
          GetMousePos(X, Y);
          Mouse(X, Y, 0, 0, True);
          Result := True;
          WriteLn(IntToStr(K));
          ColorToleranceSpeed(CTS);
          Exit;
        end;
      end;
    end;

    SCAR Code:
    function FindMeanColour(NumberArray : TIntegerArray) : TIntegerArray;
    var
      I : Integer;
      H, S, L : Extended;
      R, G, B : Integer;
      X, Y, Z : Extended;

      HTotal, STotal, LTotal : Extended;
      HMean, SMean, LMean : Extended;

      RTotal, GTotal, BTotal : Integer;
      RMean, GMean, BMean : Integer;
     
      XTotal, YTotal, ZTotal : Extended;
      XMean, YMean, ZMean : Extended;
    begin
      SetArrayLength(Result, 3);

      for I := 0 to High(NumberArray) do
      begin
        ColorToHSL(NumberArray[I], H, S, L);
        ColorToRGB(NumberArray[I], R, G, B);
        ColorToXYZ(NumberArray[I], X, Y, Z);

        HTotal := HTotal + H;
        STotal := STotal + S;
        LTotal := LTotal + L;

        RTotal := RTotal + R;
        GTotal := GTotal + G;
        BTotal := BTotal + B;

        XTotal := XTotal + X;
        YTotal := YTotal + Y;
        ZTotal := ZTotal + Z;
      end;

      HMean := HTotal/Length(NumberArray);
      SMean := STotal/Length(NumberArray);
      LMean := LTotal/Length(NumberArray);

      RMean := RTotal/Length(NumberArray);
      GMean := GTotal/Length(NumberArray);
      BMean := BTotal/Length(NumberArray);

      XMean := XTotal/Length(NumberArray);
      YMean := YTotal/Length(NumberArray);
      ZMean := ZTotal/Length(NumberArray);

      Result[0] := HSLToColor(HMean, SMean, LMean);
      Result[1] := RGBToColor(RMean, GMean, BMean);
      Result[2] := XYZToColor(XMean, YMean, ZMean);
    end;

    function FindGlobalTolerance(NumberArray : TIntegerArray) : Integer;
    var
      I : Integer;
    begin
      for I := 1 to High(NumberArray) do
      while not(SimilarColors(NumberArray[I], NumberArray[I - 1], Result)) do
        Inc(Result);
    end;

    procedure FindHSLInfo(NumberArray : TIntegerArray);
    var
      I : Integer;

      H, S, L : TExtendedArray;
      R, G, B : TIntegerArray;
      X, Y, Z : TExtendedArray;

      HSArray, HLArray, SLArray : TExtendedArray;
      RBArray, RGArray, GBArray : TIntegerArray;
      XYArray, XZArray, YZArray : TExtendedArray;

      GenericColourArray : TIntegerArray;
    begin
      SetArrayLength(H, Length(NumberArray));
      SetArrayLength(S, Length(NumberArray));
      SetArrayLength(L, Length(NumberArray));

      SetArrayLength(R, Length(NumberArray));
      SetArrayLength(G, Length(NumberArray));
      SetArrayLength(B, Length(NumberArray));
     
      SetArrayLength(X, Length(NumberArray));
      SetArrayLength(Y, Length(NumberArray));
      SetArrayLength(Z, Length(NumberArray));
     
      SetArrayLength(HSArray, Length(NumberArray));
      SetArrayLength(HLArray, Length(NumberArray));
      SetArrayLength(SLArray, Length(NumberArray));
     
      SetArrayLength(RGArray, Length(NumberArray));
      SetArrayLength(RBArray, Length(NumberArray));
      SetArrayLength(GBArray, Length(NumberArray));

      SetArrayLength(XYArray, Length(NumberArray));
      SetArrayLength(XZArray, Length(NumberArray));
      SetArrayLength(YZArray, Length(NumberArray));
     
      for I := 0 to High(NumberArray) do
      begin
        ColorToHSL(NumberArray[I], H[I], S[I], L[I]);
        ColorToRGB(NumberArray[I], R[I], G[I], B[I]);
        ColorToXYZ(NumberArray[I], X[I], Y[I], Z[I]);
      end;
       
      for I := 0 to High(NumberArray) do
      begin
        HSArray[I] := H[I] - S[I];
        HLArray[I] := H[I] - L[I];
        SLArray[I] := S[I] - L[I];
       
        RGArray[I] := R[I] - G[I];
        RBArray[I] := R[I] - B[I];
        GBArray[I] := G[I] - B[I];

        XYArray[I] := X[I] - Y[I];
        XZArray[I] := X[I] - Z[I];
        YZArray[I] := Y[I] - Z[I];
      end;
     
      GenericColourArray := FindMeanColour(NumberArray);
     
      WriteLn('Santy''s HSL Characteristic Finder!');
      WriteLn(' ');
      WriteLn('Generic HSL Colour : ' + IntToStr(GenericColourArray[0]));
      WriteLn('Generic RGB Colour : ' + IntToStr(GenericColourArray[1]));
      WriteLn('Generic XYZ Colour : ' + IntToStr(GenericColourArray[2]));
     
      WriteLn('Max Tolerance : ' + IntToStr(FindGlobalTolerance(NumberArray)));
      WriteLn(' ');
      WriteLn('Min H : ' + FloatToStr(AMinE(H)) + ', Max H : ' + FloatToStr(AMaxE(H)));
      WriteLn('Min S : ' + FloatToStr(AMinE(S)) + ', Max S : ' + FloatToStr(AMaxE(S)));
      WriteLn('Min L : ' + FloatToStr(AMinE(L)) + ', Max L : ' + FloatToStr(AMaxE(L)));
      WriteLn(' ');
      WriteLn('Min H - S : ' + FloatToStr(AMinE(HSArray)) + ', Max H - S : ' + FloatToStr(AMaxE(HSArray)));
      WriteLn('Min H - L : ' + FloatToStr(AMinE(HLArray)) + ', Max H - L : ' + FloatToStr(AMaxE(HLArray)));
      WriteLn('Min S - L : ' + FloatToStr(AMinE(SLArray)) + ', Max S - L : ' + FloatToStr(AMaxE(SLArray)));
      WriteLn(' ');
      WriteLn('Min R : ' + IntToStr(AMin(R)) + ', Max R : ' + IntToStr(AMax(R)));
      WriteLn('Min G : ' + IntToStr(AMin(G)) + ', Max G : ' + IntToStr(AMax(G)));
      WriteLn('Min B : ' + IntToStr(AMin(B)) + ', Max B : ' + IntToStr(AMax(B)));
      WriteLn(' ');
      WriteLn('Min R - G : ' + IntToStr(AMin(RGArray)) + ', Max R - G : ' + IntToStr(AMax(RGArray)));
      WriteLn('Min R - B : ' + IntToStr(AMin(RBArray)) + ', Max R - B : ' + IntToStr(AMax(RBArray)));
      WriteLn('Min G - B : ' + IntToStr(AMin(GBArray)) + ', Max G - B : ' + IntToStr(AMax(GBArray)));
      WriteLn(' ');
      WriteLn('Min X : ' + FloatToStr(AMinE(X)) + ', Max X : ' + FloatToStr(AMaxE(X)));
      WriteLn('Min Y : ' + FloatToStr(AMinE(Y)) + ', Max Y : ' + FloatToStr(AMaxE(Y)));
      WriteLn('Min Z : ' + FloatToStr(AMinE(Z)) + ', Max Z : ' + FloatToStr(AMaxE(Z)));
      WriteLn(' ');
      WriteLn('Min X - Y : ' + FloatToStr(AMinE(XYArray)) + ', Max X - Y : ' + FloatToStr(AMaxE(XYArray)));
      WriteLn('Min X - Z : ' + FloatToStr(AMinE(XZArray)) + ', Max X - Z : ' + FloatToStr(AMaxE(XZArray)));
      WriteLn('Min Y - Z : ' + FloatToStr(AMinE(YZArray)) + ', Max Y - Z : ' + FloatToStr(AMaxE(YZArray)));
    end;

    SCAR Code:
    function MakeDDTM(InventorySpot : Integer; ItemName : string) : Boolean;
    var
      I : Integer;
      DDTMBox : TBox;
      DDTMMainPoint : TPoint;
      DDTMPoints : TPointArray;
      DDTMSubPoints : TPointArrayArray;
    begin
      if not(InRange(InventorySpot, 1, 28)) then
      begin
        WriteLn('Inventory Spot Must Be Between 1 And 28, Inclusive');
        WriteLn('Exiting');
        Exit;
      end;
     
      DDTMBox := InvBox(InventorySpot);
      DDTMMainPoint := ItemCoords(InventorySpot);
      FindColorsTolerance(DDTMPoints, 65536, DDTMBox.X1, DDTMBox.Y1, DDTMBox.X2, DDTMBox.Y2, 0);

      DDTMSubPoints := TPAToATPA(DDTMPoints, 10);

      WriteLn(ItemName + 'Main.X := ' + IntToStr(DDTMMainPoint.X));
      WriteLn(ItemName + 'Main.Y := ' + IntToStr(DDTMMainPoint.Y));
      WriteLn(ItemName + 'Main.AreaSize := 0');
      WriteLn(ItemName + 'Main.AreaShape := 0');
      WriteLn(ItemName + 'Main.Color := ' + IntToStr(GetColor(DDTMMainPoint.X, DDTMMainPoint.Y)));
      WriteLn(ItemName + 'Main.Tolerance := 255');

      for I := 0 to High(DDTMSubPoints) do
      begin
        WriteLn(' ');
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].X := ' + IntToStr(DDTMSubPoints[I][0].X));
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Y := ' + IntToStr(DDTMSubPoints[I][0].Y));
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].AreaSize := 0');
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].AreaShape := 0');
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Color := 65536');
        WriteLn(ItemName + 'Sub[' + IntToStr(I) + '].Tolerance := 0');
      end;
     
      Result := True;
    end;

    Descriptions :
    • FindMouse : Find a toy mouse on the ground. Results true if clicked. Adds mouse colour into TIntegerArray.
    • FindTree : Finds any tree on mainscreen...maybe except willows. Results true if clicked.
    • HSL Tool : Finds characteristics of a TIntegerArray. Lowest and highest H, S, L, R, G, B, X, Y, Z, while also finding the lowest and highest differences.
    • MakeDDTM : Makes a DDTM of an item in the inventory. You can choose the name and inventory spot by filling in the parameters.


    This is my first function thread, rate it or hate Constructive criticism is appreciated...and so is flaming, gives me a chance to take out all my anger on someone. Bye now
    [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]

  2. #2
    Join Date
    Dec 2007
    Posts
    362
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Nice, you may be able to make a "Agiglity Toy Mouse" script, if there isn't one.

  3. #3
    Join Date
    May 2007
    Posts
    177
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Theres already an Agility Mouse trainer by EvilChicken

    http://www.villavu.com/forum/showthread.php?t=23002
    http://www.fenjer.com/adnan/SRLStats/1035.png
    If I see you autoing with level 3/default clothes/crap name I WILL report you. Auto Correctly!

  4. #4
    Join Date
    Jun 2007
    Posts
    785
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OMfg sweet functions Santy Pwnz0r?

    [22:20] <[-jesus-]> freddy, go uninstall yourself

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

    Default

    how fast is that findtree function? and does it find multiple trees on screen?

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

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

    Default

    FindTree takes 47 Ms to find three trees, each tree has around 200 points on it.

    Thanks Dumpin, appreciate the comment.
    [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]

  7. #7
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Nice functions, but still not sure where why the MakeDDTM is a function as you would have to run it by itself anyway so has no use in an 'if() then' (and maybe also make it able to assign everything to a DDTM structure during runtime instead of having to run it then fill in everything - then having it as a boolean function would make sense).
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. The reason why Santy is so smart!
    By BobboHobbo in forum Discussions & Debates
    Replies: 21
    Last Post: 02-08-2008, 10:30 PM
  2. Santy ElfTalker!
    By Santa_Clause in forum RS3 Outdated / Broken Scripts
    Replies: 24
    Last Post: 12-08-2007, 05:30 AM
  3. Santy Fighter!
    By Santa_Clause in forum RS3 Outdated / Broken Scripts
    Replies: 22
    Last Post: 08-06-2007, 03:30 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
  •