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)?
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)?
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
Just something I threw together.Code:Var TP: TPointArray; TI: TIntegerArray; begin TP := [Point(1,5),Point(2,6)]; TI := [1231423, 1231234, 123123]; end.![]()
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."
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
Nice expansion Smarter ChildI 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."
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
There are currently 1 users browsing this thread. (0 members and 1 guests)