SRL Archive - SRL Archives

nMouse();


noidea

2008-12-23 13:30:25

It's quite simple, but it works.
It determines from your current mouse position how for to go past and how high or low to go past your object. It will then come back and click, left or right. IT automatically adds randomness.

LIke I said, its simple.

OH yea. Sandstorm asked for help on a function like this a while ago.
So I just wrote my own this morning looking the the scripts I have.

Rate, HAte?

Used like

nMouse(x, y, 'Your rs uptext here', LeftClickOrRight);


Function nMouse(x, y: Integer; s: String; Left: Boolean): Boolean;
var
OrigSpeed, Option, Tx, Ty, Gx, Gy, Lx, Ly: Integer;
begin
OrigSpeed := MouseSpeed;
Tx := 0;
Ty := 0;
GetMousePos(Gx, Gy);
If( Gx >= x )and( Gy >= y )then Option := 0;
If( Gx <= x )and( Gy <= y )then Option := 1;//Option := 1;
If( Gx >= x )and( Gy <= y )then Option := 2;
If( Gx <= x )and( Gy >= y )then Option := 3;
case Option of
0: begin
Tx := -70;
Ty := -60;
end;

1: begin
Tx := 70;
Ty := 60;
end;

2: Begin
Tx := -70;
Ty := 60;
end;

3: begin
Tx := 70;
Ty := -60;
end;
end;
MouseSpeed := randomRange(30, 32);
Writeln(inttostr(MouseSpeed));
mmouse(x + Tx, y + Ty, 6, 6);
wait(20+random(50));
MouseSpeed := 7 + random(2);
Writeln(inttostr(MouseSpeed));
mmouse(x, y, 4, 4);
wait(100+random(100));
if isuptext(s) then
begin
getmousepos(lx, ly);
mouse(x, y, 0, 0, left);
Result := True;
MouseSpeed := OrigSpeed;
exit;
end;
Writeln('Error: Wrong UpText!');
Result := False;
MouseSpeed := OrigSpeed;
end;

Sandstorm

2008-12-23 14:04:37

Hah, you spelt my name wrong :).

Question, what does this do? Overclick, then go back? Or slow down as it gets closer? Because if it's the first one, then I have one of those (or is it both?).

Ok, just looked at it. You did what I did. Yours will make a series of arcs, not one long one :P.

noidea

2008-12-23 14:25:15

Yea, mine makes one giant arc then comes back.
I was thinking about one that make like a circle arc.

Sandstorm

2008-12-23 14:39:16

I mean without the misclick, yours would make a series of arcs towards the item.

I've been working on a human mouse proc, here's what I have. Not all that good though. I'll also post my misclick procedure.

HMouse:


Program New;
{.include srl/srl.scar}

Procedure HMouse(x, y, rx, ry : Integer);
Var
cx, cy, option: integer;
randSpeed, var1, var2, var3, var4 : Extended;
Begin
MouseSpeed := 15;
randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
if randSpeed = 0.0 then
randSpeed := 0.1;
getMousePos(cx,cy);
X := x + randomrange(-rx, rx);
Y := y + randomrange(-ry, ry);
Var1 := 10.0/randSpeed;
Var2 := 15.0/randSpeed;
Var3 := 10.0*randSpeed;
Var4 := 10.0*randSpeed;
WindMouse(cx,cy,x - 50 - random(50),y - 50 - random(50),9.0,3.0,var1,var2,var3,var4);
MouseSpeed := MouseSpeed - 7;
WriteLn(IntToStr(MouseSpeed));
GetMousePos(cx, cy);
WindMouse(cx,cy,x - 25 - random(25),y - 25 - random(25),9.0,3.0,var1,var2,var3,var4);
MouseSpeed := MouseSpeed - 7;
WriteLn(IntToStr(MouseSpeed));
GetMousePos(cx, cy);
WindMouse(cx,cy,x,y,9.0,3.0,var1,var2,var3,var4);
End;

Begin
SetupSrl;
HMouse(500, 500, 5, 5);
End.

Misclick:


Program New;
{.include srl/srl.scar}

{*******************************************************************************
Function AboveBelow(x, y : integer) : Integer;
By: Sand Storm
Description: Checks whether your in a certain area compared to a point.
*******************************************************************************}
Function AboveBelow(x, y : integer) : Integer;
Var
XX, YY : Integer;
begin
Xx := x;
Yy := y;
GetMousePos(x, y);
if (x < Xx) and (y < yy) then
Begin
Result := 1;
Exit;
End;
if (x < Xx) and (y > yy) then
Begin
Result := 2;
Exit;
End;
if (x > Xx) and (y > yy) then
Begin
Result := 3;
Exit;
End Else
Result := 4;
End;

{*******************************************************************************
Procedure Misclick(Chance, P, A : Integer; Left : Boolean);
By: Sand Storm
Description: Should sometimes misclick by moving the mouse farther than it
should by 20-30 pixels, then reverse back up to the real coords.
*******************************************************************************}
Procedure Misclick(Chance, p, a : Integer; left : boolean);
Begin
Case AboveBelow(p, a) Of
1 : Case Random(Chance) Of
0 : Begin
Mouse(p + 20 + random(10), a + 20 + random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
2 : Case Random(Chance) Of
0 : Begin
Mouse(p + 20 + random(10), a - 20 - random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
3 : Case Random(Chance) Of
0 : Begin
Mouse(p - 20 - random(10), a - 20 - random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
4 : Case Random(Chance) Of
0 : Begin
Mouse(p - 20 - random(10), a + 20 + random(10), 3, 3, left);
Mmouse(p + 20 + random(10), a - (30 + random(10)) - random(10), 3, 3);
Mouse(p, a, 3, 3, left);
End;
1..Chance : Mouse (p, a, 3, 3, left);
end;
End;
end;

Begin
SetupSrl;
Misclick(2, 620, 337, false);
End.

Let me know if you want me to take em down (I don't want to steal your spotlight :o).

~Sandstorm

noidea

2008-12-23 14:42:55

Nah, you can keep them there is you explain to me how WindMouse() works :)

Sandstorm

2008-12-23 14:55:31

I'm not actually 100% sure how it works, but I believe it sort of winds off to the left/right of the object, and gravitates towards it. All I did was take that out of the MMouse procedure and make it store to variables, instead of right in the function, lol.

~Sandstorm

P.S. I saw the note in the MMouse procedure. Lazy Devs! Lol.

//Randomness is just added to the x,y. Might want to change that.

Easy fix though(I think):


{*******************************************************************************
procedure MMouse(x, y, rx, ry: integer);
By: Benland100. Small fix by Sandstorm.
Description: Moves the mouse.
*******************************************************************************}
procedure MMouse(x, y, rx, ry: integer);
var
cx, cy: integer;
randSpeed: extended;
begin
randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
if randSpeed = 0.0 then
randSpeed := 0.1;
getMousePos(cx,cy);
X := x + randomrange(-rx, rx);
Y := y + randomrange(-ry, ry);
WindMouse(cx,cy,x,y,9.0,3.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
end;

MylesMadness

2008-12-23 15:58:55

From: Sandstorm
P.S. I saw the note in the MMouse procedure. Lazy Devs! Lol.

//Randomness is just added to the x,y. Might want to change that.

Easy fix though(I think):


{*******************************************************************************
procedure MMouse(x, y, rx, ry: integer);
By: Benland100. Small fix by Sandstorm.
Description: Moves the mouse.
*******************************************************************************}
procedure MMouse(x, y, rx, ry: integer);
var
cx, cy: integer;
randSpeed: extended;
begin
randSpeed:= (random(MouseSpeed) / 2.0 + MouseSpeed) / 10.0;
if randSpeed = 0.0 then
randSpeed := 0.1;
getMousePos(cx,cy);
X := x + randomrange(-rx, rx);
Y := y + randomrange(-ry, ry);
WindMouse(cx,cy,x,y,9.0,3.0,10.0/randSpeed,15.0/randSpeed,10.0*randSpeed,10.0*randSpeed);
end;
Srl members have been arguing about that for ever. We decided it should stay like that as everything has already been made for that one

Sandstorm

2008-12-23 16:07:59

It wouldn't change anything, as long as it wasn't massive random amounts, like 50+, in my opinion.

NiCbaZ

2008-12-23 16:12:03

Yes it would , all script would break, BitMaps would mess up etc, ( This is what admins and devs have told us).

Sandstorm

2008-12-23 16:14:20

I don't believe it.

All it's doing is changing the place it clicks by a few pixels (depending on the RX and RY amounts).

Not my decision though.

Sorry for spamming your topic NoIdea :o.

~Sandstorm

Nava2

2008-12-24 00:31:05

Bitmaps are found using the Top Left corner, so, in turn, when you say something like Mouse(x, y, 20, 40) you SHOULD know that you are moving a possible 20 right and 40 down.

noidea

2008-12-24 11:43:14

From: Nava2
Bitmaps are found using the Top Left corner, so, in turn, when you say something like Mouse(x, y, 20, 40) you SHOULD know that you are moving a possible 20 right and 40 down.


Nava2, was that directed at me or the others?

Sandstorm

2008-12-24 14:22:19

From: noidea
Nava2, was that directed at me or the others?


It was directed at me.

@Nava - Is there seriously a place where you use 20, 40 for randomness?

senrath

2008-12-24 14:34:48

From: Sandstorm
It was directed at me.

@Nava - Is there seriously a place where you use 20, 40 for randomness?


Probably not, but the idea holds true with smaller amounts of randomness.

Tootoot222

2008-12-25 11:19:40

From: Sandstorm
there seriously a place where you use 20, 40 for randomness?


Yes, if you used AreaInfo, BankIndexToMSPoint or ItemCoords to get some point, and you wanted to randomly click that item (without using MouseBox), you would have about 30, 30 randomness. MouseBox also uses Mouse/MMouse.