Log in

View Full Version : [Question]SRL Code



markizano
04-10-2007, 05:10 PM
Is there already an explanation of the SRL code line by line. If so, can someone link me to it. Im trying to translate some of it into VB6.

If not, then I would like to know what the try/except code is and/or what it does. It would help to have other examples of how it should be used. Here's where I found it (This was in the MouseFlag.scar):



function MMouse(dx, dy, RandX, RandY: Integer): Boolean;
var
Path: TPointArray;
i, cx, cy, Lx, Ly, xx, yy, Dist, MidRX, MidRY: Integer;
Step, SlowDown: Extended;
begin
Result := True;
if (BenMouse) then
begin
try
MidRX := Round(RandX / 2);
MidRY := Round(RandY / 2);
dx := dx + MidRX + NormDist(MidRX);
dy := dy + MidRY + NormDist(MidRY);
if dx < 0 then dx := 0;
if dy < 0 then dy := 0;
GetMousePos(cx, cy)
if not ((Cx - dx = 0) and (Cy - dy = 0)) then
begin
Path := MakeMouseSplinePath(cx, cy, dx, dy, 7, 50, 40);
Lx := cx;
Ly := cy;
for i := 0 to GetArrayLength(Path) - 1 do
begin
MoveMouse(Path[i].x, Path[i].y);
Dist := Round(Sqrt((Path[i].x - dx) * (Path[i].x - dx) + (Path[i].y -
dy) * (Path[i].y - dy)));
if Dist < 50 then
begin
SlowDown := SlowDown + (0.05 * MouseSpeed);
end;
Wait(Round(((Random(2) + MouseSpeed) / 10) * Sqrt(Sqr(Path[i].x - Lx)
+ Sqr(Path[i].y - Ly)) + SlowDown));
Lx := Path[i].x;
Ly := Path[i].y;
end;
end;
MoveMouseSmooth(dx, dy);
except
WriteLn('Error in BenMouse');
WriteLn('Report: ' + IntToStr(cx) + ', ' + IntToStr(cy) + ' : ' +
IntToStr(dx) + ', ' + IntToStr(dy) + ' : ' + IntToStr(mousespeed) +
';');
end;
end else
begin // Start Mutant/RsN MMouse
step := 4;
xx := NormDist(RandX);
yy := NormDist(RandY);
dx := dx + xx;
dy := dy + yy;
GetMousePos(x, y);
repeat
if (Distance(x, y, dx, dy) < 100) then
if (not (Distance(x, y, dx, dy) = 0)) then
step := step - (10 / Distance(x, y, dx, dy));
if (step < 1) then
step := 1;
x := x + Round((dx - x) / step);
y := y + Round((dy - y) / step);
MoveMouse(x, y);
Wait(MouseSpeed);
until (Distance(x, y, dx, dy) = 0);
end;
end;


Is it as point blank as I think it is. Just try the lines of code within the parameter and if they don't work, then what?

-------------------------------------
Another question
Can someone explain the TPointArray DataType a little more clearly, I have to make that one from scratch since VB doesn't have anything related to that.

I may have more questions later on...

Markizano