Results 1 to 6 of 6

Thread: ItemColors: Array of Array of Integer

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

    Default ItemColors: Array of Array of Integer

    I made this function that picks colors of items in inventory for you without any DTMs, Colors or BitMaps needed to input, all you need to give it is inventory slot(s).

    Nothing big, but even more useful if you know what slot you want to autocolor.

    Ignores inventory color and 65536 (black).

    Umm I am not sure how good this works with a fishing net, since its pretty same coloured as the inventory background..

    Btw also removes duplicate colors from the result
    SCAR Code:
    Function InitInvTPA(Slot: Integer): TPointArray;

    Var

      W, H, L, CTS: Integer;

      TB: TBox;
     
    Begin

      TB := InvBox(Slot);
     
      CTS := GetColorToleranceSpeed;
     
      ColorToleranceSpeed(2);
     
      For W := TB.x1 To TB.x2 Do
      Begin
     
        For H := TB.y1 To TB.y2 Do
        Begin
       
          If( Not SimilarColors(GetColor(W, H), 3489352, 10))
            And (Not (GetColor(W, H) = 65536)) Then
          Begin
         
            L := GetArrayLength(Result);
            SetArrayLength(Result, L + 1);
            Result[L] := IntToPoint(W, H);
           
          End;
         
        End;
       
      End;
     
      ColorToleranceSpeed(CTS);
     
    End;

    Function ItemColors(Slots: TIntegerArray): Array of Array of Integer;

    Var

      SL, F, T, S, L: Integer;
     
      TPA: TPointArray;
     
    Begin

      If Not LoggedIn Then Exit;
     
      SL := GetArrayLength(Slots);
     
      If Not GetArrayLength(Slots) = 1 Then
      Begin

        F := 0;
        T := SL - 1;

      End Else
      Begin

        F := 0;
        T := 0;
      End;
     
      For S := F To T Do
      Begin
     
        If Not ExistsItem(Slots[s]) Then Continue;

        TPA := InitInvTPA(s);
       
        L := GetArrayLength(Result);
       
        SetArrayLength(Result, L + 1);
       
        SetArrayLength(Result[L], GetArrayLength(TPA));
       
        Result[L] := GetColors(TPA);
       
        ClearSameIntegers(Result[l]);

      End;
    End;

    EDIT: Results are in the same order as the slots you input, like [1, 2], it would return the 1st slot as the Result[0] and the 2nd as Result[1] etc..

  2. #2
    Join Date
    Aug 2007
    Location
    England
    Posts
    734
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Whats this useful for? only thing i can think of is finding stuff on the ground
    The truth finally came out...


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

    Default

    You wasnt here when autocolor was invented

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

    Default

    well, I think for finding e.g pickaxe or wc axe colors, so it can see what pic you are using, wich is maybe handy for when you loose your pickaxe head

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

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

    Default

    Thanks, yes, usage like that'd be good, though people use FindPickHeadColor.

    Glad to see your chicken killer is doing good..

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

    Default

    hehe me to ;P

    thanks I might use this function once in my willow choppa

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

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Array in an array...
    By Lorax in forum OSR Advanced Scripting Tutorials
    Replies: 20
    Last Post: 01-16-2010, 09:10 PM
  2. How do I return an array of integer?
    By R0b0t1 in forum OSR Help
    Replies: 7
    Last Post: 06-27-2007, 03:42 AM
  3. Array of Tbox - And TPoint array helps.
    By R0b0t1 in forum OSR Help
    Replies: 4
    Last Post: 06-10-2007, 06:43 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
  •