SRL Archive - SRL Suggestions

RMouse


TomTuff

2010-11-03 20:59:42

{*******************************************************************************
procedure RMouse(mousex, mousey, ranx, rany: Integer; left: Boolean);
By: TomTuff
Description: Juse like Mouse, but the randoms are +/-
*******************************************************************************}
procedure RMouse(mousex, mousey, ranx, rany: Integer; left: Boolean);
begin
Mouse(mousex, mousey, RandomRange(-(ranx), ranx), RandomRange(-(rany), rany, left);
end;

Cstrike

2010-11-03 21:01:57

I wish there was this option when I applied ;)

I always ended up thinking you had to put the mouse at the middle and the randoms were +/-. This would be quite useful since anyone who knows the random of the regular Mouse random, can easily apply that to this mouse. Plus it's easier possibly to mod this procedure for a Gaussian function (which I have and it works awesome, everyone should make their own and try it out! Really looks legit too :))

anonymity

2010-11-03 21:55:18

I really like this idea. * For a while I used to think that the random mouse was both directions, then I figured it out and just dealt with it.

Good call. :thumbsup:

TomTuff

2010-11-03 22:14:39

Also, just thought i'd sho some proof this works:
Blue dots = RMouse
Red dots = Mouse
Green dots = MMouse -> getMousePos -> Mouse(x, y, 0, 0, true)

i luffs yeww

2010-11-03 22:35:13

There has been discussions about this. I wish I could find the threads but I'm too lazy. The reason has something to do with everything else searching from 0, 0 to the max width and height, and people see things from top to bottom, left to right (in America, generally, at least). So the reason would be that it logically makes sense to most people if they searched for it in that way (0, 0 -> 100, 100 or something).

Narcle

2010-11-03 22:56:57

We've had many discussions about actually changing Mouse to this system but it was deemed "to late" as most functions are already accustomed to the current way its used. I myself have gotten use to it by using mouse like this: Mouse(x-2, y-2, 4, 4, true) its more to type but that's just how it is right now.

Something this simple shouldn't be added in my opinion, if the scripter really wants it they can just add it to the script.

Dgby714

2010-11-04 00:27:53

I was bored…

{*******************************************************************************
procedure RMouse(X, Y, RandX, RandY: integer; Left: variant);
By: TomTuff
Description: Juse like Mouse, but the randoms are +/-
*******************************************************************************}
procedure RMouse(X, Y, RandX, RandY: integer; Left: variant);
begin
RandX := RandomRange(-(iAbs(RandX)), iAbs(RandX));
RandY := RandomRange(-(iAbs(RandY)), iAbs(RandY));
{$IFDEF SRL}
Mouse(X, Y, RandX, RandY, ((Left) or (Left = 1)));
{$ELSE}
if (Left) then
Left := 1
else
Left := 0;

IncEx(X, RandX);
IncEx(Y, RandY);
MoveMouse(X, Y);
ClickMouse(X, Y, Left);
{$ENDIF}
end;

Gu3st...

2010-11-04 03:04:37

I just do
Mouse(X-15, Y-15, 30, 30, 1);

Bad Boy JH

2010-11-12 20:51:00

can I just say
procedure RMouse(X, Y, RanX, RanY: Integer; Left: Boolean);
begin
Mouse(X, Y, RandomRange(-RanX, RanX), RandomRange(-RanY, RanY), Left);
end;

would actually create a parabolic Distrbuition of clicks…

we could do something slightly different, make it exponential…(I think)

procedure RMouse(X, Y, RanX, RanY: Integer; Left: Boolean);
var
XMod, YMod: Integer;
begin
for I := 1 to RanX do
begin
IncEx(XMod, Random(1));
DecEx(XMod, Random(1));
end;

for I := 1 to RanY do
begin
IncEx(YMod, Random(1));
DecEx(YMod, Random(1));
end;

Mouse(X + XMod, Y+YMod, 0, 0, Left);

of course you could change the left to the way MouseBox does it…

TomTuff

2010-11-13 02:29:29

From: Bad Boy JH
can I just say
procedure RMouse(X, Y, RanX, RanY: Integer; Left: Boolean);
begin
Mouse(X, Y, RandomRange(-RanX, RanX), RandomRange(-RanY, RanY), Left);
end;

would actually create a parabolic Distrbuition of clicks…

we could do something slightly different, make it exponential…(I think)

procedure RMouse(X, Y, RanX, RanY: Integer; Left: Boolean);
var
XMod, YMod: Integer;
begin
for I := 1 to RanX do
begin
IncEx(XMod, Random(1));
DecEx(XMod, Random(1));
end;

for I := 1 to RanY do
begin
IncEx(YMod, Random(1));
DecEx(YMod, Random(1));
end;

Mouse(X + XMod, Y+YMod, 0, 0, Left);

of course you could change the left to the way MouseBox does it…


Huh? How so?

Also, the procedure you listed just clicked the same spot everytime (randomness of 100, 100)

Bad Boy JH

2010-11-13 08:03:41

yes, I made a boo-boo, it should be random(2) not 1…

procedure RMouse(X, Y, RanX, RanY: Integer; Left: Boolean);
var
XMod, YMod: Integer;
begin
for I := 1 to RanX do
begin
IncEx(XMod, Random(2));
DecEx(XMod, Random(2));
end;

for I := 1 to RanY do
begin
IncEx(YMod, Random(2));
DecEx(YMod, Random(2));
end;

Mouse(X + XMod, Y+YMod, 0, 0, Left);
end;

Gu3st...

2010-11-13 09:30:28

XMod := XMod - 1 + Random(3)
is the same as
IncEx(XMod, Random(2));
DecEx(XMod, Random(2));

TomTuff

2010-11-13 12:33:15

Bad Boy JH, that procedure returns this result:
That's 250 clicks, using RMouse(200,200,100,100,true), the target being the black dot in the middle.

Bad Boy JH

2010-11-13 19:07:15

yes, it is way to centralised…

Edit: Working on a way which takes into account the starting mouse position

and here it is… sort of…

function DeterminePoint(StartingPoint: TPoint; Box: TBox): TPoint;
var
MidPoint, Tmp: TPoint;
begin
MidPoint := Point((Box.x1 + Box.x2) / 2, (Box.y1 + Box.y2) / 2);
if StartingPoint.x < Box.x1 then
Tmp.x := RandomRange(Box.x1, MidPoint.x) else
if StartingPoint.x > Box.x2 then
Tmp.x := RandomRange(Box.x2, MidPoint.x) else
Tmp.x := RandomRange(StartingPoint.x, MidPoint.x);

if StartingPoint.y < Box.y1 then
Tmp.y := RandomRange(Box.y1, MidPoint.y) else
if StartingPoint.y > Box.y2 then
Tmp.y := RandomRange(Box.y2, MidPoint.y) else
Tmp.y := RandomRange(StartingPoint.y, MidPoint.y);

Result.x := Tmp.x - Min(Random(Tmp.x - Box.x1), Random(Tmp.x - Box.x1)) + Min(Random(Box.x2 - Tmp.x), Random(Box.x2 - Tmp.x));
Result.y := Tmp.y - Min(Random(Tmp.y - Box.y1), Random(Tmp.y - Box.y1)) + Min(Random(Box.y2 - Tmp.y), Random(Box.y2 - Tmp.y));
end;

It currently spits out a TPoint, cause I was testing where it clicked, however it will use Mouse, if used.

This takes two inputs, StartingPoint, where the mouse STARTS from, when you click a button, you tend to click on the side of the button your mouse is closest to….
the second, Box, is the area you wish to click in…