SRL Archive - SRL Suggestions

Small change to mouse


Stevee

2010-03-16 08:51:35

Mouse(x, y, randomx, randomy, boolean);

My (small) suggestion.

Mouse(x, y, randomx, randomy, boolean, [offsetx], [offsety]);

[ ] Meaning optional.

What this does is, after you click, it moves the mouse slightly (very small wait, if any). This is because, as a human, odds are when you click something the mouse is moved. You don't just drag the mouse to an object, have it stop perfectly, then click it without moving it. I mean, it's possible, but improbable. The same thing I suggest could be achieved with MMouse(x, y, 0, 0); Mouse(x, y, 2, 2, true);.
Filling in the offsets with 0 or not filling them in at all will use no offset.

Nava2

2010-03-16 09:53:13

We can't actually do this in PS :(, the optional part at least.

I like the idea though.

Dgby714

2010-03-16 11:53:11

From: Nava2
We can't actually do this in PS :(, the optional part at least.

I like the idea though.


O.o hmm weird in scar default values dont work but in lazarus they do….

Stevee

2010-03-16 12:40:33

There's no way to make parameters optional? That kinda sucks..

Then it would have to be given a name…either that, or it could completely replace Mouse, though I doubt it. Maybe OMouse for offset-mouse, I don't know.

Dgby714

2010-03-16 12:54:40

meh i came up with this but it sucks lol

program Test;
{.include SRL/SRL.scar}

procedure MouseEx(TVA: TVariantArray);
var
ALength, SX, SY, EX, EY, TX, TY: integer;
begin
ALength := Length(TVA);
//Checking array length
if (not((ALength = 5) or (ALength = 7))) then
begin
WriteLn('Incorrect Syntax! MouseEx([x, y, randx, randy: integer; Left: boolean; offsetx, offsety: integer]);');
Exit;
end;

//Checking Parameter types
if (ALength = 5) then
begin;
if (not ((VarType(TVA[0]) = varInteger) or (VarType(TVA[1]) = varInteger) or (VarType(TVA[2]) = varInteger) or (VarType(TVA[3]) = varInteger) or (VarType(TVA[4]) = varBoolean))) then
begin
WriteLn('Incorrect Syntax! MouseEx([x, y, randx, randy: integer; Left: boolean;]);');
Exit;
end;
end else
begin
if (not ((VarType(TVA[0]) = varInteger) or (VarType(TVA[1]) = varInteger) or (VarType(TVA[2]) = varInteger) or (VarType(TVA[3]) = varInteger) or (VarType(TVA[4]) = varBoolean) or (VarType(TVA[5]) = varInteger) or (VarType(TVA[6]) = varInteger))) then
begin
WriteLn('Incorrect Syntax! MouseEx([x, y, randx, randy: integer; Left: boolean; offsetx, offsety: integer]);');
Exit;
end;
end;

//Mousing O.o =)
GetMousePos(SX, SY);
Mouse(TVA[0], TVA[1], TVA[2], TVA[3], TVA[4]);
GetMousePos(EX, EY);
if (ALength = 7) then
begin
if (SX > EX) then
TX := EX - TVA[5]
else
TX := EX + TVA[5];
if (SY > EY) then
TY := EY - TVA[6]
else
TY := EY + TVA[6];
MMouse(TX, TY, TVA[2], TVA[3]);
end;
end;

begin
SetupSRL;
MouseEx([250, 250, 5, 5, False, 3, 3]);
MouseEx([500, 500, 5, 5, False]);
end.

Stevee

2010-03-16 12:57:15

Problem is, with that proc being that long, would it have a noticable delay?
Though splines are very long too..

HyperSecret

2010-03-16 13:26:14

Why not just edit your mouse function to have the possiblity? In Mouse() just expand your params to include the offsetx, offsety, then just add MMouse() after the actual clicking. You really don't have to make anything 'new' for this.

Mouse(x, y, randomx, randomy, boolean, [offsetx], [offsety]); 
begin
blah blah blah
Click
Mouse(x,y,offsetx, offsety);
end;

mixster

2010-03-16 13:35:08

I'm not sure about other people, but I don't move my mouse after I click - kind of I move, then click as I stop. Just wanted to share that and suggest instead of turning all arguments into a TVarArray, just add a TIntArr to the end then if the length of it = 2, then use that as offset else ignore - means you still have the readability of all over options as normal and code only has to be slightly modified to include the one length check at the end.

Nava2

2010-03-16 14:05:27

Hmm, perhaps implement this as a completely different mouse function?

No speed loss etc.

Dynamite

2010-03-16 15:42:40

Why not just:

Procedure OffSetMouse(Tx, Ty : integer);
var
Nx, Ny : integer;
Begin
GetMousePos(Nx, Ny);
MMouse(Nx, Ny, Tx, Ty);
end;

rya

2010-03-16 16:17:03

From: The Man
Why not just:

Procedure OffSetMouse(Tx, Ty : integer);
var
Nx, Ny : integer;
Begin
GetMousePos(Nx, Ny);
MMouse(Nx, Ny, Tx, Ty);
end;


Try

Procedure OffSetMouse(Tx, Ty : integer);
var
Nx, Ny : integer;
Begin
GetMousePos(Nx, Ny);
Mouse(Nx, Ny, 0, 0,True);
MMOuse(Nx,Ny,Tx,Ty);
End;
Need to click

Nava2

2010-03-16 17:15:55

No, The Man had it correct.

Good idea. I think:

procedure OffSetMouse(mX, mY: Integer);
var
tX, tY: Integer;
begin
getMousePos(tX, tY);
MMouse(tX - mX, tY - mY, mX * 2, mY * 2);
end;

Is slightly better. Either way, good idea The Man.

NCDS

2010-03-16 17:36:07

From: Nava2
No, The Man had it correct.

Good idea. I think:

procedure OffSetMouse(mX, mY: Integer);
var
tX, tY: Integer;
begin
getMousePos(tX, tY);
MMouse(tX - mX, tY - mY, mX * 2, mY * 2);
end;

Is slightly better. Either way, good idea The Man.


In Stevee's suggestion though, he has the mouse click, then move after the click.

i luffs yeww

2010-03-16 18:19:15

But the point of this is to click then move slightly, then move back. So what TM/N2 were saying is that if you really want this, do Mouse(50, 50, 50, 50, True); OffSetMouse(50, 50);

:) I think.

Stevee

2010-03-16 18:53:42

No, no need to move back. This is just a seamless offset AFTER clicking! Humans don't stop the mouse AS SOON AS the click, the mouse continues a bit after and while clicking.
Also, i luffs yeww's rendition is another idea. When moving the mouse, it would be good to have a chance of OVERSHOOTING the movement, and having to quickly move the mouse back. More humanized.

Frement

2010-03-16 18:59:33

From: Stevee
No, no need to move back. This is just a seamless offset AFTER clicking! Humans don't stop the mouse AS SOON AS the click, the mouse continues a bit after and while clicking.
Also, i luffs yeww's rendition is another idea. When moving the mouse, it would be good to have a chance of OVERSHOOTING the movement, and having to quickly move the mouse back. More humanized.


It has been done, like 3-4 years ago someone made a function that "overshooted" the target, and then moved back. Also i got another idea, why not make a function that has multiple targets to click without stopping the mouse. Or randomly slowing mouse movement while clicking and then speeding up if the other point is far away. Just some ideas.

And i dont think i never click an object and then keep moving the mouse, my hand stops at the object.

Sabzi

2010-03-16 19:30:07

Scripts rarely stops after clicking. Most of the time it moves to the next position just like a human would do. For example you just clicked drop from option menu and you are already on the way to the next item. Scripts do this exactly the same, they don't hang after clicking. Well, most of the time.
And when I am not in a hurry then I stop right after clicking so does my scripts do this.

Coh3n

2010-03-16 20:04:51

If anything I misclick something. My mouse doesn't move once I've clicked (unless I've moved on to what ever I'm doing).

i luffs yeww

2010-03-16 20:36:57

Well from what I understand, Jagex doesn't monitor movements, but they do monitor clicks. So misclicking would be the only useful antiban for mouse-related functions, but not movement.

Sorry if that's not right. :<

Xanith

2010-03-16 22:26:39

What if you did something like this:


procedure MMouseOffset(x, y, randx, randy, offx, offy : integer, left : boolean)
begin
Mouse(x, y, randx, randy, left); //moves mouse to coords
MMouse(x + offx, y + offy, 0, 0); //moves the mouse off the spot clicked if its zero then it wont move.
end;


Would something like that work?

Coh3n

2010-03-16 22:37:13

From: Xanith
What if you did something like this:


procedure MMouseOffset(x, y, randx, randy, offx, offy : integer, left : boolean)
begin
MMouse(x, y, randx, randy, left); //moves mouse to coords
Mouse(x + offx, y + offy, 0, 0); //moves the mouse off the spot clicked if its zero then it wont move.
end;


Would something like that work?

You have the functions mixed up. Mouse clicks and MMouse just moves the mouse.

Xanith

2010-03-16 22:54:07

From: Coh3n
You have the functions mixed up. Mouse clicks and MMouse just moves the mouse.


:duh:

Other than that, I'm pretty sure that it would work. Though I know that someone can do better than me. =P

Dynamite

2010-03-17 13:30:56

From: Nava2
No, The Man had it correct.

Good idea. I think:

procedure OffSetMouse(mX, mY: Integer);
var
tX, tY: Integer;
begin
getMousePos(tX, tY);
MMouse(tX - mX, tY - mY, mX * 2, mY * 2);
end;

Is slightly better. Either way, good idea The Man.


Thank you, and, yeh that is better.
But, guys, if anything this is the way you want to do it.
You move your mouse to the target and click while you are still moving.

i luffs yeww

2010-03-17 19:51:29

Like I said before, they don't monitor movement, but they do monitor clicking, which we do fine.

MylesMadness

2010-03-17 20:33:55

From: i luffs yeww
Like I said before, they don't monitor movement, but they do monitor clicking, which we do fine.
They CAN see your mouse movement, but it is unlikly they do