Results 1 to 3 of 3

Thread: SpySkillObj - commented and whitespaced

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

    Default SpySkillObj - commented and whitespaced

    I whitespaced it and commented it if some people want to learn
    (atleast r0b0t requested).

    So, what it does -

    SCAR Code:
    Function SpySkillObj(Var Ox, Oy: Integer; ObjColors: TIntegerArray; Width,
     Height, E: Integer): Boolean;

    Ox and Oy are the coordinates the object coordinates return to.

    Objcolors, here fill couple colors or one of the obj.

    Width and Height of the obj.

    E - this is how many percent atleast you want the color cover the object.

    This one also doesnt require uptext, no worries, the percent thing covers it up pretty well.

    Why this is called SpySkillObj, because usually objects used in different skills are "same color", they may even be fully covered with "the same color", but different lightness/ darkness, for example old rocks, trees, when you make a fire with tinderbox and logs the flame is also pretty much orange/yellow with a lil adjustment.

    So, for example, if you are finding a tree, you are supposed to enter a light, dark color or light, little darker, middle dark, dark.

    The function takes the colors' "together middle", so dont worry about it yourself

    Feel free to ask anything about it...

    Sorry people who dont want to see a thing about my object finding, but this is totally different than the ones I posted before...


    SCAR Code:
    //*------------------------------------------*\\
    //*-------- Bwuahahahaa, ITS ALIVE! ---------*\\
    //*------------------------------------------*\\
    Function SpySkillObj(Var Ox, Oy: Integer; ObjColors: TIntegerArray; Width,
     Height, E: Integer): Boolean;

    Var
      HSL: Array of Array of Extended;
      C, Le, I, Color, X: Integer;
      TPA, TPA2: TPointArray;
      Time, CTS: Integer;
      Semi: Extended;
      PerC: Integer;
      TB: TBox;
      TP: TPoint;
      H, S, L: Extended;
      Colors: TIntegerArray;

    Begin

      If Not LoggedIn Then Exit;
     
      Time := GetSystemTime;  // Saves current time in ms to Time
     
      CTS := GetColorToleranceSpeed; // Saves current CTS to CTS
     
      If Not GetArrayLength(ObjColors) = 0 Then
      Begin
        If GetArrayLength(ObjColors) Mod 2 = 0 Then
        // ^^ If hard to explain, try the mod a lil so you know, like 8 mod 2 etc..
        Begin
          Le := GetArrayLength(ObjColors) - 1;
          Writeln('Color array length was even...');
        End Else
        Begin
          Le := GetArrayLength(ObjColors) - 2;
          Writeln('Color array length was odd...');
        End;

        Color := ObjColors[0]; // for "default"

        Try
          // below calculates the middle of two colors.
          For I := 0 To Le Do
          Begin

            Colors := [Color, ObjColors[i + 1]];

            SetArrayLength(HSL, 2);
            SetArrayLength(HSL[0], 3);
            SetArrayLength(HSL[1], 3);

            For C := 0 To 1 Do
            Begin
              ColorToHSL(Colors[c], HSL[c][0], HSL[c][1], HSL[c][2]);
            End;

            H := HSL[1][0] - ((HSL[1][0] - HSL[0][0])/4);
            S := HSL[1][1] - ((HSL[1][1] - HSL[0][1])/4);
            L := HSL[1][2] - ((HSL[1][2] - HSL[0][2])/2);

            Color := HSLToColor(H, S, L);
          End;
        Except
          Writeln('Could not use crazy professor formula');
        End;
      End Else
      Begin
        Color := ObjColors[0];
      End;

      ColorToleranceSpeed(1); // Uses RGB for color comparison

      FindColorsSpiralTolerance(MSCX, MSCY, TPA, Color, 20, 20, MSX2 - 20, MSY2 - 20, 5);

      TPA := ReArrangeAndShortenArrayEx(TPA, Width, Height);
      // Rearranges and shortens TPA so that there is only one point per "square"
      // - the Round(wi....)
     
      Le := GetArrayLength(TPA) - 1;

      For X := 0 To Le Do
      Begin
        TP := TPA[x];

        TB.x1 := TP.x - Round(Width / 2);
        TB.y1 := TP.y - Round(Height / 2);
        TB.x2 := TP.x + Round(Width / 2);
        TB.y2 := TP.y + Round(Height / 2);

        FindColorsSpiralTolerance(TP.x, TP.x, TPA2, Color, TB.x1, TB.y1, TB.x2, TB.y2, 10);

        // Now we calculate percent of the color in the box
        Semi := GetArrayLength(TPA2) / (Width * Height);
        PerC := Round(Semi * 100);
        If PerC > E  Then
        // ^^ Checks if the colors percent in box is greater than E
        Begin
          // Then we take middle of the TPA2 and save it to Ox and Oy, result true.
          If MiddleTPAEx(TPA2, Ox, Oy) Then
          Begin
            Result := True;
            Break;
          End;
        End;
      End;
      ColorToleranceSpeed(CTS); // Sets color comparison back to original
      Writeln('Finding took: '+IntToStr(GetSystemTime - Time));
    End;

    I realized that why should anyone want to find multiple objs, for normal use because anyways when you move to one the others positions change

    ~n3ss3s

    P.S: If you are finding old rocks, remember that there is couple real smaller "rocks" in one rock, and between them is ground, so fill the widths and heights considering things like these.


    E: 0 posts, 12 views?! Darn leechers!

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

    Default

    I like...I like.

    Good job. Why the interest in object finding all of a sudden?
    [CENTER][img]http://signatures.mylivesignature.com/54486/113/4539C8FAAF3EAB109A3CC1811EF0941B.png[/img][/CENTER]
    [CENTER][BANANA]TSN ~ Vacation! ~ says :I Love Santy[/BANANA][/CENTER]

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

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

    Default

    hes training for the competition .. And hes teaming with me..

    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!

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
  •