SRL Archive - Research & Development Lounge

Human Mouse Procedures


Skepsis

2008-01-22 01:03:34

This procedure is very similar to the Mouse procedure. However, like a human, it will miss the coordinates that are set and then come back to it.

I thank Ducels for helping me correct and fix some errors.

EDIT: I edited the procedure so it has an option for an accurate one. According to Ducel's suggestion. Also, with Ducel's help, changed the procedure so it is much neater.


Procedure HumanMouse(mousex, mousey, ranx, rany: Integer; left: Boolean);
var
OrigSpeed: integer;
begin
OrigSpeed:= MouseSpeed;
MouseSpeed:= MouseSpeed - 2 + random(5); //new random speed
Case Random(5) of
0-1:begin
MMouse(mousex - Random(10), mousey - Random(10), ranx, rany);
Mouse(mousex, mousey, ranx, rany,left);
end;
2-3:begin
MMouse(mousex + Random(10), mousey + Random(10), ranx, rany);
Mouse(mousex, mousey, ranx, rany,left);
end;
4:Mouse(mousex, mousey, ranx, rany,left);
end;
MouseSpeed:= OrigSpeed //back to original mousespeed
end;


Procedure HumanMouseBox(x1, y1, x2, y2, clicktype: Integer);
var
OrigSpeed: integer;
begin
OrigSpeed:= MouseSpeed;
MouseSpeed:= MouseSpeed - 2 + random(5); //new random speed
Case Random(5) of
0-1:begin
MMouse(x1 - Random(10), y1 - Random(10),0,0);
MouseBox(x1, y1, x2, y2, clicktype);
end;
2-3:begin
MMouse(x2 + Random(10), y2 + Random(10),0,0);
MouseBox(x1, y1, x2, y2, clicktype);
end;
4:MouseBox(x1, y1, x2, y2, clicktype);
end;
MouseSpeed:= OrigSpeed //back to original mousespeed
end;

ducels

2008-01-22 01:11:41

They look pretty good.

You could still improve them by making it sometimes not miss, since humans don't always miss.

Otherwise it's good for your second scripted material.

nielsie95

2008-01-22 02:03:46

  2-3:begin
MMouse(mousex + Random(10), mousey + Random(10), ranx, rany);
Mouse(mousex, mousey, ranx, rany,left);
end;

It will never do this one, as 2 - 3 = -1 and Random doesn't return negative numbers.

Skepsis

2008-01-22 19:41:29

From: nielsie95
  2-3:begin
MMouse(mousex + Random(10), mousey + Random(10), ranx, rany);
Mouse(mousex, mousey, ranx, rany,left);
end;

It will never do this one, as 2 - 3 = -1 and Random doesn't return negative numbers.



Sorry if I sound like a doushe, but your wrong. 2-3 means that it does "blablabla" for cases from 2 to 3. its not 2 minus 3. So thats why. Run it. It runs perfectly.

Timer

2008-01-22 19:56:59

use
2, 3 :

Jackrawl

2008-01-22 21:42:57

lol whats this do, MMouse isn't detected by Jagex.

ZephyrsFury

2008-01-22 22:19:25

From: Skepsis
Sorry if I sound like a doushe, but your wrong. 2-3 means that it does "blablabla" for cases from 2 to 3. its not 2 minus 3. So thats why. Run it. It runs perfectly.


You can't do that. You have to go 2, 3. If you go 2-3 it will think you mean -1. Also Mouse is the same as MMouse except it clicks so you don't need to called both procedures.

You could also do something like this:


procedure HumanMouse(x, y, xmod, ymod: Integer; Left: Boolean);
begin
Mouse(x - 10 + Random(20), y - 10 + Random(20), xmod, ymod, Left);
end;

That way you don't need the cases.

bullzeye95

2008-01-22 22:53:49

From: Skepsis
Sorry if I sound like a doushe, but your wrong. 2-3 means that it does "blablabla" for cases from 2 to 3. its not 2 minus 3. So thats why. Run it. It runs perfectly.


program New;
begin
case 3 of
2-3: writeln('you''re right!');
else
writeln('you''re wrong');
end;
end.
program New;
begin
case 3 of
2,3: writeln('nielsie''s right!');
else
writeln('nielsie''s wrong');
end;
end.