SRL Archive - Help and Support

lmouse help!!


Hobbit

2008-06-28 11:09:43

Here is the new function i have been creation.
*Hears whispers in the background "OMG HOBBIT IS ACTUALLY USING SCAR"*

Anyways the new function is to give the same segmented strokes while moving the mouse as that of a laptop. It decides how many strokes to do depending on the distance being traveled.

Now the problem is… it isn't moving correctly… Ill let you run it yourself and you will see what I mean…. and just be patient with it… it will get there… and look in the debug… that may help you (once it gets there).

program New;
{.include SRL/SRL.scar}

procedure lmouse(x, y, randomx, randomy : Integer);
Var
cx, cy, seg, e, f, g, nx, ny, hypo : integer;
a, b, c : extended;
begin
e:= 0;
GetMousePos(cx, cy);
a:= (x - cx);
b:= (y - cy);
c:=Pow(a,2) + Pow(b,2)
hypo:= Round(Sqrt(c));
Writeln(IntToStr(hypo));
if(hypo = 0) then
begin
Writeln('[ERROR]: One of your "lmouse()" commands is not filled out correctly');
Writeln('Distance moved cannot = 0!');
end;
case hypo of
0: TerminateScript;
1..50: seg:=1;
51..150: seg:= 2;
151..300: seg:= Random(2) + 3;
301..1800: seg:= random(3) + 4;
end;
if(seg > 1)then
begin
f:= Round( a / seg);
g:= Round( b / seg);
repeat
Wait(1000);
MMouse((cx + f), (cy + g), Random(10), Random(10));
e:= e + 1;
Writeln(inttostr(e));
until(e = (seg - 1))
MMouse((cx + f), (cy + g), randomx, randomy);
end;
if(seg = 1)then
MMouse(x, y, randomx, randomy);
end;

begin
lmouse(1,1,4,3);
end.

nielsie95

2008-06-28 11:20:50


program New;
{.include SRL/SRL.scar}

procedure lmouse(x, y, randomx, randomy : Integer);
Var
cx, cy, seg, e, f, g, nx, ny, hypo : integer;
a, b, c : extended;
begin
e:= 0;
GetMousePos(cx, cy);
a:= x - cx;
b:= y - cy;
c:= Pow(a,2) + Pow(b,2)
hypo:= Round(Sqrt(c));
Writeln(IntToStr(hypo));
case hypo of
0: TerminateScript;
1..50: seg:=1;
51..150: seg:= 2;
151..300: seg:= Random(2) + 3;
301..1800: seg:= random(3) + 4;
else seg := 5;
end;
f:= Round( a / seg);
g:= Round( b / seg);
repeat
Wait(1000);
MMouse((cx + (f * e)), (cy + (g * e)), Random(10), Random(10));
e:= e + 1;
Writeln(inttostr(e));
until(e = seg);
GetMousePos(cx, cy);
if Distance(x, y, cx, cy) > 5 then
begin
Wait(500);
MMouse(x, y, Random(randomx), Random(randomy));
end;
end;

begin
MouseSpeed := 6;
lmouse(500,500,4,3);
end.

The major thing I changed was: (cx + (f * e)), (cy + (g * e))

Hobbit

2008-06-28 11:23:34

UGH!! THANK YOU

I didnt realize that when i took out the nx:= cx +f; and ny:= cy + g;

THANK YOU

now just last final tweeking :)

Dan Cardin

2008-06-28 13:49:19

your function gave me a cool idea for a function, thanks :).

Hobbit

2008-06-28 21:59:00

For what?

Dan Cardin

2008-06-29 07:55:21

another mouse moving function, ;). only problem is i need to basically recreate your function cuz id need the sectional stops, though it wont be as much of a problem because i can just divide by a number and get a my sections, and be done.

EDIT: ^is kinda confusing.