SRL Archive - SRL Bugs

InvMouse non-gaussian distribution


oligofren

2012-01-16 00:05:46

I noticed that InvMouse tends to click on edge of inventory position
so I run few test to find distribution of clicks

MouseBox works very well producing Gaussian distribution of clicks



Uploaded with ImageShack.us

InvMouse is screwed and I am trying to find out what is wrong there



Uploaded with ImageShack.us

this needs fixing ASAP because it is highly detectable and everyone is using it

oligofren

2012-01-16 00:30:56

nvm, still trying to figure out

InvBox works fine:

1 box= 563 , 213 , 594 , 244
2 box= 605 , 213 , 636 , 244
3 box= 647 , 213 , 678 , 244
4 box= 689 , 213 , 720 , 244
5 box= 563 , 249 , 594 , 280
6 box= 605 , 249 , 636 , 280
7 box= 647 , 249 , 678 , 280
8 box= 689 , 249 , 720 , 280
9 box= 563 , 285 , 594 , 316
10 box= 605 , 285 , 636 , 316
11 box= 647 , 285 , 678 , 316
12 box= 689 , 285 , 720 , 316
13 box= 563 , 321 , 594 , 352
14 box= 605 , 321 , 636 , 352
15 box= 647 , 321 , 678 , 352
16 box= 689 , 321 , 720 , 352
17 box= 563 , 357 , 594 , 388
18 box= 605 , 357 , 636 , 388
19 box= 647 , 357 , 678 , 388
20 box= 689 , 357 , 720 , 388
21 box= 563 , 393 , 594 , 424
22 box= 605 , 393 , 636 , 424
23 box= 647 , 393 , 678 , 424
24 box= 689 , 393 , 720 , 424
25 box= 563 , 429 , 594 , 460
26 box= 605 , 429 , 636 , 460
27 box= 647 , 429 , 678 , 460
28 box= 689 , 429 , 720 , 460

Press Play

2012-01-16 00:32:37

A very interesting find! ^_^ I just had a look at InvMouse, and I believe that it is because it uses MouseBoxEx? This was probably for SRL4 because MouseBoxEx looks like it tries to aim for the centre…That would be the only change I'm guessing:
function InvMouse(InvSlot, Action: Byte) : boolean;
var
TB: TBox;
CurrPT : TPoint;
begin
result := false;
if (not InRange(Action, 0, 3)) then
begin
srl_Warn('InvMouse', 'Action #' + IntToStr(Action) + ' is not a valid action', warn_AllVersions);
Exit;
end;
if (not InRange(InvSlot, 1, 28)) then
begin
srl_Warn('InvMouse', 'Inventory slot #' + IntToStr(InvSlot) + ' is not a valid slot', warn_AllVersions);
Exit;
end;
GameTab(tab_inv);
Result := true;
TB := InvBox(InvSlot);
GetMousePos(CurrPT.x,CurrPT.y);
if PointInBox(CurrPT,TB) then
MouseBox(Max(CurrPT.x-random(2),TB.x1),Max(CurrPT.y-random(2),TB.y1),
Min(CurrPT.x+random(2),TB.x2),Min(CurrPT.y+random(2),TB.y2),Action) //LOL Pro-human much!
else
MouseBox(TB.X1, TB.Y1, TB.X2, TB.Y2, Action);
end;

EDIT: also as stated above ^, why are the second pair of co-ordinates to high!! O_o
InvBox:
Slot6 := IntToBox(605, 249, 31415, 92653);

EDIT2: [offtopic]
There is no difference between MouseItem and InvMouse? :S Shouldn't we remove one?
procedure MouseItem(I: Integer; button: Integer);
begin
InvMouse(i, button);
end;
[/offtopic]

oligofren

2012-01-16 00:52:15

running script with your correction, got 400 clicks, now it looks much better



Uploaded with ImageShack.us

2000 clicks, distribution is smoother



Uploaded with ImageShack.us

Press Play

2012-01-16 03:33:02

I'm not really sure what the graphs mean (EDIT: ohh, I'm guess the axis of the graph are co-ordinates? Well at least the x-axis) :p, but if you say that it's all fixed, a dev should commit ! :D yay!

Sabzi

2012-01-16 04:41:41

I remember EvilChicken added InvMouse(or the other, I can't remember), but to keep backward compatibility with scripts using the function that was there he leaved that too and that's how there is 2 function that does the same.

oligofren

2012-01-16 11:24:38

there is 'Distr' parameter in MouseBoxEx and it is 14 when it called from InvMouse

MouseBoxEx(TB.X1, TB.Y1, TB.X2, TB.Y2,14, Action);

I ll try to vary this parameter and see how it would change the distribution of clicks

I am running herb cleaning script or jewelry enchanting script and output click coordinates into debug window then I use Excel for sorting and plotting

and axe X on graphs is X coordinate of the client, since we have 4 columns of inventory it forms 4 corresponding peaks, in case of jewelry enchanting script I had to discard 4th column because it also contained clicks from the spell activation

oligofren

2012-01-17 21:21:21

I run herbs cleaning script which moves mouse by zigzag and clicks on herbs, I left everything unchanged and got distribution shown below


then I changed Distr parameter from 14 to 8 and the distribution of clicks worsened

InvMouse uses MouseBox if mouse already in target inventory position and it uses MouseBoxEx if mouse is outside, in turn MouseBoxEx has gravity toward direction from which mouse moves into target inventory slot, this explains why columns 2, 3 have double peaks and columns 1 and 4 have single peaks, anyway MouseBoxEx has unnatural clicking pattern and MUST be changed

suggestion: replace it with MouseBox completely, which has Gaussian distribution of clicks aiming at center, Daazndagger already suggested this change, and imho it works better

Narcle

2012-01-18 16:20:32

Done.

And this:
Slot6 := IntToBox(605, 249, 31415, 92653);

They aren't even used, its probably from old formula.