Oh, sorry, I mean footballjds, yea, you can use. Yea if you credit...
For your WhirlPool...
Unknown identifier 'BoxFromTPA'
BoxFromTPA is a function of mine, if you want to use it, you might want to tweak it to GetTPABounds etc.
Also I don't know does it work, you also propably need to change a few values.
Because it was made by pure theory, even the color I made in photoshop.
gimme 1 that compiles, and ill test it! lol
and for the debug, ho do u making it highlich the colors to 255?
Is that closer to Heimlich or Highlight?highlichJk/Jk, no, the colors in the RuneScape client aren't being highlighted, its just a CopyClientToBitmap and FastDraw functions, see scar manual...
can u fix the whilpool for me?
Ben is the only one here who can cause a nature catastrophe with pure power of will.
= gimme a whirlpool, slowpoke!
SCAR Code:Function GetPixelChange(Color, x1, y1, x2, y2, Tol, WaitTime: Integer): Extended;
Var
aPts, bPts: TPointArray;
L, I, Count: Integer;
Begin
FindColorsTolerance(aPts, Color, x1, y1, x2, y2, Tol);
Wait(WaitTime);
FindColorsTolerance(bPts, Color, x1, y1, x2, y2, Tol);
L := Min(High(aPts), High(bPts));
For I := 0 To L Do
If (aPts[i].x <> bPts[i].x) and (aPts[i].y <> bPts[i].y) Then
Count := Count + 1;
Result := Count / (L + 1);
End;
^^ useful for gas / ent checking.
An other kind of MiddleTPA, the one in WizzyPlugin uses the Mean Average, this uses Median.
It isn't in plugin so with arrays that has thousands of points it takes some time, 6501 points took 541ms, but 400 points took 0-15 ms.
How it works -
in WizzyPlugin, it does X := X + Point[i].x and same for Y and then divides it by the length of the array.
Mine gets the "middliest" point in an array that is sorted from small to large, the X and Y arrays, and then simply put does X := xArray[middle].x etc.
It takes the median point, go read from wikipedia...
SCAR Code:Function Median(Ints: TIntegerArray): Extended;
Var
I: Integer;
Begin
BubbleSort(Ints);
I := GetArrayLength(Ints);
If I Mod 2 <> 0 Then
Begin
Result := Ints[Round(High(Ints) / 2)];
End Else
Begin
Result := (Ints[Round(High(Ints) / 2)-1] + Ints[Round(High(Ints) /2)]) / 2;
End;
End;
Function n_MiddleTPAEx(TPA: TPointArray; Var mX, mY: Integer): Boolean;
Var
xA, yA: TIntegerArray;
I: Integer;
Begin
Result := GetArrayLength(TPA) >= 3;
If Not Result Then
Exit;
SetArrayLength(xA, GetArrayLength(TPA));
SetArrayLength(yA, GetArrayLength(TPA));
For I := 0 To High(TPA) Do
Begin
xA[i] := TPA[i].x;
yA[i] := TPA[i].y;
End;
QuickSort(xA);
QuickSort(yA);
mX := Round(Median(xA));
mY := Round(Median(yA));
End;
AutoColorThisEx (You need my UpdateColorFromArray for it)
SCAR Code:Function AutoColorThisEx(bmp, Ref, Tol, x1, y1, x2, y2: Integer): Integer;
Var
X, Y, I, W, H, Gx, Gy, Z: Integer;
c: TIntegerArray;
Begin
Result := - 1;
If FindBitmapToleranceIn(bmp, x, y, x1, y1, x2, y2, Tol) Then
Begin
GetBitmapSize(bmp, W, H);
Z := w * h - 1;
SetArrayLength(C, z + 1);
Gx := Max(X - 3, 0);
Gy := Max(Y - 3, 0);
For I := 0 To Z Do
c[i] := GetColor(Gx + (I mod W), Gy + (I div H));
Result := UpdateColorFromArray(Ref, c);
End;
End;
Nielsie's fix, now it works as supposed to.
Behold - GetNick:
SCAR Code:program New;
{.include SRL/SRL/Misc/ArrayLoader.scar}
Function Capitalized(C: Char): Boolean;
Begin
Result := LowerCase(C) <> C;
End;
Function GetNick(Username: String; NickLength: Integer): String;
Var
Parts, validParts: TStringArray;
z, q, w, i, c: Integer;
Begin
Parts := StrToStrArray(Username);
SetArrayLength(validParts, GetArrayLength(Parts));
For I := 0 To High(Parts) Do
If Length(Parts[i]) >= NickLength Then
Begin
validParts[z] := Parts[i];
z := z + 1;
End;
SetArrayLength(validParts, z);
For I := 0 To Z Do
Begin
For C := 1 To Length(validParts[i]) Do
If Not Capitalized(validParts[i][c]) Then
If q <= 3 Then
q := q + 1
Else
Break
Else
w := w + 1;
If q >= NickLength Then
Begin
Result := Copy(validParts[i], w + 1, q);
Exit;
End;
End;
End;
begin
Writeln(GetNick('Ran2dom Name', 3));
end.
Capitalized by Wizzup.
For all your alphabetic number getting needs:
SCAR Code:{*******************************************************************************
Function GetAlphabet(C: Char): Integer;
By: n3ss3s
Description: Returns the alphabetic number of a character.
*******************************************************************************}
Function GetAlphabet(C: Char): Integer;
Begin
Result := iAbs(65 - GetKeyCode(C)) + 1;
End;
SCAR Code:Function Revert(S: String): String;
Var
I: Integer;
Begin
SetLength(Result, Length(S));
For I := 1 To Length(S) Do
Result[i] := S[Length(S) - i + 1];
End;
For checking if we are moving:
SCAR Code:Function AreWeMoving(wTime, minChance: Integer): Boolean;
Var
A, R, X, Y, I, C: Integer;
Col: TIntegerArray;
TPA: TPointArray;
Begin
If Not LoggedIn Then Exit;
SetArrayLength(TPA, 10);
SetArrayLength(Col, 10);
For I := 0 To 9 Do
Begin
A := (I + 1) * 40 + Random(50);
R := 15 + Random(60);
X := MMCX + Round(R * Cos(A / 180 * Pi));
Y := MMCY + Round(R * Sin(A / 180 * Pi));
TPA[i] := Point(X, Y);
End;
Col := GetColors(TPA);
Wait(wTime);
For I := 0 To 9 Do
If GetColor(TPA[i].x, TPA[i].y) <> Col[i] Then
C := C + 1;
Result := C > minChance;
End;
A new function, SortColors! http://www.villavu.com/forum/showthr...146#post366146
There are currently 1 users browsing this thread. (0 members and 1 guests)