Nadeem
2009-05-11 06:10:10
Hi,
Well I kind of made this feature for the fun of it :P I will now explain how to use and the uses for this. Keep in mind, this is not always the best thing to depend on though, because of angles (high, low). Works best when its in the angle whilst the abstract points were taken. (Obviously…) I will try and create a small built in block in the function to get the closest possible angle. (Won't promise it though)
[HOW TO USE:]

[USING EFFECTIVELY:]
IMPORTANT LOGIC: Make sure you keep a TimeFromMark set when calling the procedure. An effective TimeFromMark would be between the average time in ms it take the player to travel that distance, and the max time it would take walking.
Walking/Running
- For best effect result, try and keep the abstract near the center of your player, overlapping his/her legs. This way, it catches movement of your player's legs, and not finish up based on rs grass.
Skills (Woodcutting, Mining, etc…)
- Would be more effect if you keep the abstract around the upper head/should of the player, to catch hand movement.
[MY SPECIAL FUNCTION TO SEARCH FOR POINT IN ABSTRACT:]
[THE FUNCTION:]
~NS
Well I kind of made this feature for the fun of it :P I will now explain how to use and the uses for this. Keep in mind, this is not always the best thing to depend on though, because of angles (high, low). Works best when its in the angle whilst the abstract points were taken. (Obviously…) I will try and create a small built in block in the function to get the closest possible angle. (Won't promise it though)
[HOW TO USE:]

while AbstractMotion(0, 25, 100, 0, 80, 100, 25, 50, TRUE) do Wait(100);
{Will give you result similar to IMG1: Super Accurate}
while AbstractMotion(0, 25, 100, 0, 80, 100, 25, 50, FALSE) do Wait(100);
{Will give you result similar to IMG1: Super Fast}[USING EFFECTIVELY:]
IMPORTANT LOGIC: Make sure you keep a TimeFromMark set when calling the procedure. An effective TimeFromMark would be between the average time in ms it take the player to travel that distance, and the max time it would take walking.
Walking/Running
- For best effect result, try and keep the abstract near the center of your player, overlapping his/her legs. This way, it catches movement of your player's legs, and not finish up based on rs grass.
Skills (Woodcutting, Mining, etc…)
- Would be more effect if you keep the abstract around the upper head/should of the player, to catch hand movement.
[MY SPECIAL FUNCTION TO SEARCH FOR POINT IN ABSTRACT:]
{×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
× Function : PointInAbstr: Boolean; | v1.0
× Author : Nadeem
× Desc. : Checks if defined points are inside an abstract.
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××}
function PointInAbstr(const TPA: TPointArray; X, Y: Integer): Boolean;
var
H, K: Integer;
C: TIntegerArray;
begin
Result := False;
H := Length(TPA) - 1;
for K := 0 to H do
begin
if ((TPA[K].Y <= Y) and (Y < TPA[H].Y)) or
((TPA[H].Y <= Y) and (Y < TPA[K].Y)) then
begin
SetLength(C, 3);
C := [(TPA[H].X - TPA[K].X), (y - TPA[K].Y), (TPA[H].Y - TPA[K].Y)];
if (x < C[0] * C[1] / C[2] + TPA[K].X) then
Result := (not(Result));
end;
H := K;
end;
end;[THE FUNCTION:]
{×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××
× Function : AbstractMotion: Boolean; | v1.5
× Author : Nadeem
× Desc. : Checks for motion in a box or in defined abstract.
×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××}
function AbstractMotion(x1,y1,x2,y2,x3,y3,x4,y4:Integer; P:Boolean): Boolean;
var
tx, ty, bmpClient, bmpClient2, Width, Height, I, J: Integer;
TPA: TPointArray;
X, Y, W, H: TIntegerArray;
D: HDC;
begin
D := GetTargetDC;
SetLength(X, 4);
SetLength(Y, 4);
X := [x1, x2, x3, x4];
Y := [y1, y2, y3, y4];
try
W := [AMin(X), AMax(X)];
H := [AMin(Y), AMax(Y)];
X := [X[0] - W[0], X[1] - W[0], X[2] - W[0], X[3] - W[0]];
Y := [Y[0] - H[0], Y[1] - H[0], Y[2] - H[0], Y[3] - H[0]];
Width := W[1] - W[0];
Height := H[1] - H[0];
bmpClient := BitmapFromString(Width, Height, '');
bmpClient2 := BitmapFromString(Width, Height, '');
CopyClientToBitmap(bmpClient, W[0], H[0], W[1], H[1]);
TPA := [IntToPoint(X[0], Y[0]), IntToPoint(X[1], Y[1]),
IntToPoint(X[2], Y[2]), IntToPoint(X[3], Y[3])];
if P then
begin
for J := 0 to Height do
for I := 0 to Width do
if(not(PointInAbstr(TPA, I, J)))then
FastSetPixel(bmpClient, I, J, 0);
end;
Wait(100);
CopyClientToBitmap(bmpClient2, W[0], H[0], W[1], H[1]);
SetTargetDC(GetBitmapDC(bmpClient2));
Result := (not(FindBitmapIn(bmpClient, tx, ty, 0, 0, Width, Height)));
finally
FreeBitmap(bmpClient);
FreeBitmap(bmpClient2);
SetTargetDC(D);
except end;
end;~NS