Results 1 to 6 of 6

Thread: Tarray

  1. #1
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default Tarray

    If TArray is a sring of colors then how does it know x and y?

    to rephrase, if in an array there are more than one color, then how does it know to click one piont(x,y)?

  2. #2
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    By TArray do you mean TPointArray? if so then the points of the Colors location are stored not the colors themselves. If you mean TIntegerArray which most people use to input colors then It doesn't store points.

    ~Brak

    Code:
    Var
      TP: TPointArray;
      TI: TIntegerArray;
    
    begin
      TP := [Point(1,5),Point(2,6)];
      TI := [1231423, 1231234, 123123];
    end.
    Just something I threw together.
    Last edited by BraK; 08-01-2011 at 10:03 AM.

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  3. #3
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by wantonman View Post
    If TArray is a sring of colors then how does it know x and y?

    to rephrase, if in an array there are more than one color, then how does it know to click one piont(x,y)?
    Well depends, as BraK explained in a TPointArray, each Point contains an X/Y coordinate, hence an Array of TPoints.

    If you are referring to an array of colours, it is most probably a TIntegerArray.

    If you are wondering how it knows x/y .. the most commonly used TIntegerArray I have seen in color script is basically like this:
    Simba Code:
    Procedure TIntegerArrayExample;
    var
     ColorArray: TIntegerArray;     //Declares var as TIntegerArray
     i, x, y: integer;
    begin
      ColorArray := [0, 1, 2, 3];   //Loads the array of Colors
      for i := 0 to High(ColorArray)do   //Cycles through the Color Array
      begin
        FindColorTolerance(x, y, ColorArray[i], MSX1, MSY1, MSX2, MSY2, 5); //FindColor!
      end;
    end;

    Really, it cycles through through the ColorArray, then when FindColorTolerance finds a colour it will store the coordinates of where it found the colour to the X and Y variables, hence allowing you to use those variables to your advantage. Example, MMouse(x, y, 0, 0); etc.

    It would be similar to a TPointArray, in that all the TPoints are made up of x/y coords

    If you want to learn more about this sort of thing and how it applies to Runescape then I highly recommend reading this tutorial: A low down on WizzyPlugin and TPA's
    Last edited by Smarter Child; 08-01-2011 at 10:29 AM. Reason: typo

  4. #4
    Join Date
    Mar 2006
    Location
    Behind you
    Posts
    3,193
    Mentioned
    61 Post(s)
    Quoted
    63 Post(s)

    Default

    Nice expansion Smarter Child I didn't have the Time to write it up when I posted it before. Rep+

    ~BraK

    "Sometimes User's don't need the Answer spelled out with Code. Sometimes all they need is guidance and explanation of the logic to get where they are going."

  5. #5
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by BraK View Post
    Nice expansion Smarter Child I didn't have the Time to write it up when I posted it before. Rep+

    ~BraK
    Thanks

  6. #6
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Simba Code:
    Procedure TIntegerArrayExample;
    var
     ColorArray: TIntegerArray;     //Declares var as TIntegerArray
     ColorsFound: Array of TPointArray;  //Also known as T2DPointArray, Is an array containing multiple arrays
     i, x, y: integer;
    begin
      ColorArray := [0, 1, 2, 3];   //Loads the array of Colors
      setLength(ColorsFound,Length(ColorArray));  //Reserves space so that every color got its own TPointArray
      for i := 0 to High(ColorArray)do   //Cycles through the Color Array
      begin
        FindColorsTolerance(ColorsFound[i], ColorArray[i], MSX1, MSY1, MSX2, MSY2, 5); //FindColor!
      end;
      print(ColorsFound);
    end;

    Coult print something like:
    Simba Code:
    [[[0,0],[2,3],[1,3]], //Points with color 0, ColorsFound[0]
    [[1,0],[3,3]], //Points with color 1, ColorsFound[1]
    [[0,1],[4,3],[4,4]], //Points with color 2, ColorsFound[2]
    [[1,1],[1,3]]] //Points with color 3, ColorsFound[3]
    Working on: Tithe Farmer

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
  •