SRL Archive - FAQ

Mouse(x, y, rx, ty, true/false);


smurg

2010-11-03 19:28:26

I thought the rx and ry for randomness for Mouse was like a '+random(rx)-random(rx)

so that it could either on say Mouse(100, 100, 10, 5, true);

go from 90 to 110 on the x, and from 95 to 105 on the y.

However, when I write scripts and watch it, it never goes behind into the negative.

It always adds the random value. Is that right?

Kasi

2010-11-03 19:32:12

i add's or takes a random value
far as i know it does it both ways

ZephyrsFury

2010-11-03 19:35:55

It always adds randomness.

If you want it to go both ways you need to specify that yourself:


Mouse(X + RandomRange(-10,10), Y + RandomRange(-10,10), 0, 0, False);

smurg

2010-11-03 19:39:08

I watch mine and I only ever see it go positive.

From everything I read, i thought it went both ways. Even all the beginner tutorials in the section I checked implied it.

———

Taking the middle of the point is what I normally do, maybe I'll just fix it and overwrite it with a local function adding and subtracting.

Runescape Pro

2010-11-03 19:43:59

I used to think the same thing but it makes sense that it only adds. If you want it to go the x amount of random pixels in both negative and positive directions, do what Zeph said.

Kasi

2010-11-03 19:46:34

shouldnt this be changed in the includes? to go both ways?

smurg

2010-11-03 19:50:31

From: pur3b100d
shouldnt this be changed in the includes? to go both ways?


From what zephyr said, it seems like it was purposely meant to only add them.

I wonder how many people think it goes negative and positive.

TomTuff

2010-11-03 19:50:32

no i just ran a test

black dot = middle of 250x250 square
red dots = Mouse(125,125,124,124,true)
green dots = MMouse(125,125,124,124); GetMousePos(x, y); Mouse(x, y, 0, 0, true);

this should be fixed.

Runescape Pro

2010-11-03 19:52:46

Good stuff Tom! So it seems that it will go positive on x and negative for y? This should be changed.

smurg

2010-11-03 19:54:36

From: Runescape Pro
Good stuff Tom! So it seems that it will go positive on x and negative for y? This should be changed.


Well positive on Y also, being that the scripting y-axis is overhead :) and increasingly positive downwards.

smurg

2010-11-03 19:55:36

For now, i just added


procedure MC(x, y, rx, ry: integer; left: boolean);
begin
Mouse(x + RandomRange(-rx,rx), y + RandomRange(-ry,ry), 0, 0, left);
end;

To my scripts and changed the Mouse() to MC() for MouseClick :).

ZephyrsFury

2010-11-03 20:05:30

Both adding and subtracting randomness has been discussed before and the usual argument against them is compatibility and problems with bitmaps; FindBitmap, etc returns the top left corner of a bitmap, and thus attempting to click this bitmap with +ve and -ve randomness would mean you'd misclick 3/4ths of the time.

Kasi

2010-11-03 20:13:45

From: ZephyrsFury
Both adding and subtracting randomness has been discussed before and the usual argument against them is compatibility and problems with bitmaps; FindBitmap, etc returns the top left corner of a bitmap, and thus attempting to click this bitmap with +ve and -ve randomness would mean you'd misclick 3/4ths of the time.


but mouse hasent been made for that one function alone?

ZephyrsFury

2010-11-03 20:58:40

From: pur3b100d
but mouse hasent been made for that one function alone?


That's true but at the moment this is how MMouse works and changing it may cause lots of problems.

TomTuff

2010-11-03 21:00:42

Made suggestion in SRL forum. check it.

Gu3st...

2010-11-04 03:11:33

This has been reported as a 'problem' a great amount of time

Wizzup?

2010-11-04 05:08:39

Not going to happen. You can use MouseBox if you have the entire box of the object? Or just subtract a default from the x and y. But do this only for your own mouse clicks and not for the SRL mouse function.