SRL Archive - OSR Help

Randomness in Mouse functions


Sax

2012-12-02 10:42:16

I have noticed that the randomness parameter in MMouse only increases the x and y value.
example:

MMouse(10, 10, 5, 5)

it clicks a x value from 10 to 15. and a y value from 10 to 15 too.

but it should click a x value from 5 to 15 and a y value from 5 to 15 too.

Well, I think it should…

Is it working as usual and it doesn't decrease because it always been like that? or is something wrong?


crappy english I know… :redface:

masterBB

2012-12-02 11:05:49

It has always been like this. Really odd, I know. But this was like this in scar and since then we didn't want to break any existing scripts. I suggest using MouseBox or

procedure MyMMouse(x, y, rand:Integer);
begin
MMouse(x - rand, y - rand, rand, rand);
end;

Laimonas171

2012-12-02 11:06:19

I'm not on my computer so if what are you saing is right.

MMouse(10, 10, 5, 5); // add random +5 to each
//so this should do 10 10 coordinates as center and 5 would be kinda "radius" around that point I guess
MMouse(10, 10, RandomRange(-5, 5), RandomRange(-5, 5)); //should do +- random

Sax

2012-12-02 11:23:42

Thanks guys :D I could have done that. I just didn't occur me :duh:

Sax

2012-12-02 11:27:26

From: Laimonas171
I'm not on my computer so if what are you saing is right.

MMouse(10, 10, 5, 5); // add random +5 to each
//so this should do 10 10 coordinates as center and 5 would be kinda "radius" around that point I guess
MMouse(10, 10, RandomRange(-5, 5), RandomRange(-5, 5)); //should do +- random


Wouldn't that be a random of a random?

Lets say that the RandomRange(-5, 5) is 3. then the randomness passed to the mouse function is 3. meaning it would be 0, 1, 2 or 3. If I use it it would be more likely to click near the center..

EDIT: Forget it, actually it is better that way because when your legitting you are more likely to click near center

Laimonas171

2012-12-02 14:12:49

From: Nirvana
Wouldn't that be a random of a random?

Lets say that the RandomRange(-5, 5) is 3. then the randomness passed to the mouse function is 3. meaning it would be 0, 1, 2 or 3. If I use it it would be more likely to click near the center..

EDIT: Forget it, actually it is better that way because when your legitting you are more likely to click near center


AFAIK RandomRange(-5, 5); may give you -5, -4 -3 -2 -1 0 1 2 3 4 5 so if it so if you get < 0 then mouse click more to negative side of x and y from MMouse(x, y, 5, 5); (x, y) = center; and if it's > 0 positive does click to positive sides of x, y.. correct me if I'm wrong :)