SRL Archive - Research & Development Lounge

MissMouse();


Gu3st...

2009-06-03 17:25:17

This procedure will move the mouse and miss the target and then move the mouse to the actual target, just like a humen would do.
The current mouse procedure is very accurate and do never miss the target.
procedure MissMMouse(mousex, mousey, randx, randy : Integer);
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
if Dist < 5 then
begin
MMouse(MouseX, MouseY, RandX, RandY);
Exit;
end;
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
MissX := Round(MouseX + ((MouseX - CurX) / abs(MouseX - CurX)) * Random((20 * Dist)) + Random(RandX));
MissY := Round(MouseY + ((MouseY - CurY) / abs(MouseY - CurY)) * Random((20 * Dist)) + Random(RandY));
if MissX < 0 then MissX := 0;
if MissY < 0 then MissY := 0;
MMouse(MissX, MissY, 0, 0);
Wait(60+Random(50));
MMouse(MouseX, MouseY, RandX, RandY);
end;

procedure MissMouse(mousex, mousey, randx, randy : Integer; Left : Boolean);
var
x, y: Integer;
begin
MissMMouse(MouseX, MouseY, RandX, RandY);
GetMousePos(x, y);
Mouse(x, y, 0, 0, Left);
end;
EDIT1: Oops, forgot to add "Dist := 1;"
EDIT2: Added Ceil-stuff to "Dist := ;" part and removed L and U : Boolean;

Dervish

2009-06-03 17:30:24

Impressive, I thought about this for antiban , for example when you buy something in stocks of 10, if you do it fast, you miss sometimes which makes it realistic.

Haven't read through as I do not understand 1/10th of that but nice.

Gu3st...

2009-06-03 17:33:20

From: Dr D. Dervish
Impressive, I thought about this for antiban , for example when you buy something in stocks of 10, if you do it fast, you miss sometimes which makes it realistic.

Haven't read through as I do not understand 1/10th of that but nice.

Yeah, well it wont click on the first move (when it moves to MissX and MissY) but it will move the mouse to that location :)

Thanks for fast reply

Dervish

2009-06-03 17:37:32

Do you mind if I use this in a script ? And slightly modify it ?

ShowerThoughts

2009-06-03 17:43:28

From: Dr D. Dervish
Do you mind if I use this in a script ?


I'm not sure, he did post it in PUBLIC TEST CORNER.

Gu3st...

2009-06-03 17:55:31

Hehe, feel free to use this anywhere ;)

Hobbit

2009-06-03 18:26:16

I don't really find missing a lot with a desktop mouse.

The current mouse infact does have code to miss, it is incorporated with the laptop mouse :)

Rich

2009-06-03 18:56:28

Aw…No one took much notice and said nice things when I made this :(

Naum

2009-06-03 18:57:46

Thats cool my zytex friend :).

You can use a bit of math for calculating the miss rate :).

Done for you, replace the block of if's with this:

 Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2);
If Dist = 5 Then Dec(Dist);
If Dist * 2 > 0 Then Break

ShowerThoughts

2009-06-03 19:26:01

Also, I miss a lot with my desktop mouse, maybe I got a high DPI.

XabdullahX

2009-06-03 19:46:52

Agree, i miss too, i move my mouse too fast, love to do stuff fast :D

Gu3st...

2009-06-03 19:47:46

From: NaumanAkhlaQ
Thats cool my zytex friend :).

You can use a bit of math for calculating the miss rate :).

Done for you, replace the block of if's with this:

Ah, I know there was functions for this! Thaks alot mate :)

Hobbit: I do miss with my laptop mouse too…

R1ch: Yeah I hate when that happens :S Last time I posted this function I got no replys at all, but I was a Jr Member back then…

mixster

2009-06-03 20:44:55

Infinite loop if distance is under 50, not to mention else if's make more sense in that case or distance := distance div 50; then have a case for 0, 1, 2..3, 4, else. For the Mouse rather than MMouse version, why not just get the position of mouse then perform usual Mouse? Means that if Mouse is updated then doesn't require updating that bit. Adding a user input ability to adjust the distance multiplier for the last bit as if they have a slow mouse speed (for whatever reason), missing by 80 would seem a bit weird or something along those line. Lastly, instead of determining whether or not it's up or down / left or right then assigning to a variable, you could just use that check if it should be added or taken away.

Gu3st...

2009-06-03 22:55:33

From: mixster
Infinite loop if distance is under 50, not to mention else if's make more sense in that case or distance := distance div 50; then have a case for 0, 1, 2..3, 4, else. For the Mouse rather than MMouse version, why not just get the position of mouse then perform usual Mouse? Means that if Mouse is updated then doesn't require updating that bit. Adding a user input ability to adjust the distance multiplier for the last bit as if they have a slow mouse speed (for whatever reason), missing by 80 would seem a bit weird or something along those line. Lastly, instead of determining whether or not it's up or down / left or right then assigning to a variable, you could just use that check if it should be added or taken away.

Since when is "repeat…until(True)" an infinite loop? ;)
I do not want this to be the new Mouse.
Remember that it is "MissX := MouseX + Random(StuffInsideHere)" result in max 80.

EDIT: Updated the procedure.

noidea

2009-06-03 23:37:13

And I made one before R1ch.

Naike

2009-06-03 23:40:21

Naice going.

Looks good, now keep up with this and don't stop making good stuff.

Gu3st...

2009-06-03 23:40:38

Alot of people have made these… Why haven't any of them been commited?

Bebe

2009-06-04 00:35:45

From: Zyt3x
Alot of people have made these… Why haven't any of them been commited?

Cause I'm lazy. :o

mrpickle

2009-06-04 01:10:31

you should have another integer variable as to how many times it needs to miss.

Gu3st...

2009-06-04 01:30:42

From: mrpickle
you should have another integer variable as to how many times it needs to miss.

I do not miss with my mouse more than one time, and I do not think it is necessary.

And BeBe: Spam much? :o
How would this work with laptopmouse? hmmm
EDIT: {$DEFINE UseLaptopMouse} does not work for me :(

mrpickle

2009-06-04 01:33:25

well, it happens =D, and it's not too difficult to add =). perhaps add it as MissMouseEx?

Naum

2009-06-04 11:09:18

Zytex you need to modify the mouse procedure for this, because MMouse will have a wait in between :)

Cartmann

2009-06-04 15:40:45

This looks like a great idear, will it be a part of the SRL database?
And how will it work on moveing targets?
/Cartman

Gu3st...

2009-06-04 16:27:50

From: NaumanAkhlaQ
Zytex you need to modify the mouse procedure for this, because MMouse will have a wait in between :)

What do you mean? :confused:

Cartmann: I doubt it will be added to be honest…

Naum

2009-06-04 23:15:18

Sorry about that btw, the procedure has changed since I last saw it :).
You can shorten your X < x and y thing - If you use an array ;).

E.g

For I := 0 to 4 Do
If Trunc(I mod 2) = 1 Then
Curr[I] := cord[I];

Baked0420

2009-06-04 23:29:27

From: Zyt3x
This procedure will move the mouse and miss the target and then move the mouse to the actual target, just like a humen would do.
The current mouse procedure is very accurate and do never miss the target.
procedure MissMMouse(mousex, mousey, randx, randy : Integer);
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
if MouseX < CurX then
MissX := MouseX - Random((20 * Dist) - Random(RandX))
else
MissX := MouseX + Random((20 * Dist) + Random(RandX));
if MouseY < CurY then
MissY := MouseY - Random((20 * Dist) - Random(RandY))
else
MissY := MouseY + Random((20 * Dist) + Random(RandY));
MMouse(MissX, MissY, 0, 0);
MMouse(MouseX, MouseY, RandX, RandY);
end;

procedure MissMouse(mousex, mousey, randx, randy : Integer; Left : Boolean);
var
x, y: Integer;
begin
MissMMouse(MouseX, MouseY, RandX, RandY);
GetMousePos(x, y);
Mouse(x, y, 0, 0, Left);
end;
EDIT1: Oops, forgot to add "Dist := 1;"
EDIT2: Added Ceil-stuff to "Dist := ;" part and removed L and U : Boolean;



for this part:

procedure MissMMouse(mousex, mousey, randx, randy : Integer);
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;

why do you do Dist:= twice in a row, the first one isn't really needed then, is it? so you just setting a different value over it right away.

Bebe

2009-06-04 23:30:59

From: Zyt3x
I do not miss with my mouse more than one time, and I do not think it is necessary.

And BeBe: Spam much? :o
How would this work with laptopmouse? hmmm
EDIT: {$DEFINE UseLaptopMouse} does not work for me :(

How is that spam? You asked and I answered. :rolleyes:

Gu3st...

2009-06-05 00:11:31

From: Baked0420
why do you do Dist:= twice in a row, the first one isn't really needed then, is it? so you just setting a different value over it right away.

If you look close I use Dist to calculate in the second one. Both of them are needed ;)
Try taking away "Dist := Distance(CurX, CurY, MouseX, MouseY);" now the second calculation will not work as it should.

And BeBe: Sorry, but it looked like spam at the time

NaumanAkhlaQ: I understand what you mean, but not how to do it… Come msn?

Gu3st...

2009-06-06 01:09:33

Bump! sorry for double post but I updated the old verision! :)
I shortened the if … then and added a failsafe (if X < 0 then X := 0)
Thanks to Dan Cardin for helping me shorten the if … then

Da 0wner

2009-06-06 01:40:21

procedure MissMouse(mousex, mousey, randx, randy : integer; Action : (ClickLeft, ClickRight, Move));
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
if Dist < 5 then
begin
MMouse(MouseX, MouseY, RandX, RandY);
Exit;
end;
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
MissX := Round(MouseX + ((MouseX - CurX) / abs(MouseX - CurX)) * Random((20 * Dist)) + Random(RandX));
MissY := Round(MouseY + ((MouseY - CurY) / abs(MouseY - CurY)) * Random((20 * Dist)) + Random(RandY));
if MissX < 0 then MissX := 0;
if MissY < 0 then MissY := 0;
MMouse(MissX, MissY, 0, 0);
Wait(60+Random(50));
case action of
Move : MMouse(MouseX, MouseY, RandX, RandY);
ClickLeft : Mouse(MouseX, MouseY, RandX, RandY, true);
ClickRight : Mouse(MouseX, MouseY, RandX, RandY, false);
end;
end;

Gu3st...

2009-06-06 10:37:37

From: Da 0wner
procedure MissMouse(mousex, mousey, randx, randy : integer; Action : (ClickLeft, ClickRight, Move));
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
if Dist < 5 then
begin
MMouse(MouseX, MouseY, RandX, RandY);
Exit;
end;
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
MissX := Round(MouseX + ((MouseX - CurX) / abs(MouseX - CurX)) * Random((20 * Dist)) + Random(RandX));
MissY := Round(MouseY + ((MouseY - CurY) / abs(MouseY - CurY)) * Random((20 * Dist)) + Random(RandY));
if MissX < 0 then MissX := 0;
if MissY < 0 then MissY := 0;
MMouse(MissX, MissY, 0, 0);
Wait(60+Random(50));
case action of
Move : MMouse(MouseX, MouseY, RandX, RandY);
ClickLeft : Mouse(MouseX, MouseY, RandX, RandY, true);
ClickRight : Mouse(MouseX, MouseY, RandX, RandY, false);
end;
end;

If you're gonna do it like that then you have to add one more "case action of" to the procedure…
procedure MissMouse(mousex, mousey, randx, randy : integer; Action : (ClickLeft, ClickRight, Move));
var
Dist, MissX, MissY, CurX, CurY : Integer;
begin
GetMousePos(CurX, CurY);
Dist := Distance(CurX, CurY, MouseX, MouseY);
if Dist < 5 then
begin
MMouse(MouseX, MouseY, RandX, RandY);
Wait(60+Random(50));
case action of
Move : MMouse(MouseX, MouseY, RandX, RandY);
ClickLeft : Mouse(MouseX, MouseY, RandX, RandY, true);
ClickRight : Mouse(MouseX, MouseY, RandX, RandY, false);
end;
Exit;
end;
Dist := (Ceil(Dist / 34) - Ceil(Dist / 100) + 3/2) / 2;
if Dist > 5 then Dist := 5;
if Dist < 1 then Dist := 1;
MissX := Round(MouseX + ((MouseX - CurX) / abs(MouseX - CurX)) * Random((20 * Dist)) + Random(RandX));
MissY := Round(MouseY + ((MouseY - CurY) / abs(MouseY - CurY)) * Random((20 * Dist)) + Random(RandY));
if MissX < 0 then MissX := 0;
if MissY < 0 then MissY := 0;
MMouse(MissX, MissY, 0, 0);
Wait(60+Random(50));
case action of
Move : MMouse(MouseX, MouseY, RandX, RandY);
ClickLeft : Mouse(MouseX, MouseY, RandX, RandY, true);
ClickRight : Mouse(MouseX, MouseY, RandX, RandY, false);
end;
end;

Da 0wner

2009-06-06 11:15:36

Oh yeah, sorry :<.