SRL Archive - Help and Support

Mouse scroll


Laimonas171

2012-12-04 08:46:48

I have no idea how to use (since it was not necessary to use often in scripts)

 Scrollmouse(120, 247, 1); 
Error: Exception: ScrollMouse is not available for this target at line 42




i need to scroll it up (i don't want to drag it) any ideas?

xtrapsp

2012-12-04 09:11:59

http://docs.villavu.com/simba/scriptref/mouseandkeyboard.html?highlight=scroll#mouse-functions

Couldn't find anything inside this, or the includes. Is it a dead inc?
edit: what if you static click inside the box and press PGUP?

Laimonas171

2012-12-04 09:17:45

From: xtrapsp
http://docs.villavu.com/simba/scriptref/mouseandkeyboard.html?highlight=scroll#mouse-functions

Couldn't find anything inside this, or the includes. Is it a dead inc?


HoldMouse and ReleaseMouse works well, but I would like to use Scrool one, Link you gave me: founds SCROLL: 91 but i guess it's scroll click middle mouse key

xtrapsp

2012-12-04 09:26:55

From: Laimonas171
HoldMouse and ReleaseMouse works well, but I would like to use Scrool one, Link you gave me: founds SCROLL: 91 but i guess it's scroll click middle mouse key


Worth making a function? along the lines of

ScrollDirection(UP,Lengthinpixels);

All this would do is click and drag a bar if it finds one then scroll either the up or the down in the length in pixels?

Laimonas171

2012-12-04 09:33:58

From: xtrapsp
Worth making a function? along the lines of

ScrollDirection(UP,Lengthinpixels);

All this would do is click and drag a bar if it finds one then scroll either the up or the down in the length in pixels?


Maybe..
This one works for me, but not sure or it not looks botty. :?
Procedure DragUp;
var randomScroll: integer;
begin
randomScroll := RandomRange(100, 150);
if(FindColorTolerance(x, y, 3911923, 230, 210, 232, 290, 20)) then
begin
Holdmouse(x, y, mouse_left);
wait(random(150));
MMouse(x, y-randomScroll, 2, 2);
// wait(random(150));
ReleaseMouse(x, y-randomScroll, mouse_left);
end else
begin
if(FindColorTolerance(x, y, 3911923, 229, 90, 231, 110, 20)) then
begin
Holdmouse(x, y, mouse_left);
wait(random(150));
MMouse(x, y+randomScroll, 2, 2);
// wait(random(150));
ReleaseMouse(x, y+randomScroll, mouse_left);
end;
end;
end;

xtrapsp

2012-12-04 09:53:48

Well if you want it to look more human like think of it like this,

MMouse can be replaced with Windmouse ;) That means you get a slight bit of x axis being thrown of (Which does happen, people do move their mouse up and a little left or right).

for the hold and release thats fine :)

(*
WindMouse
~~~~~~~~~

.. code-block:: pascal

procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);

Moves the mouse along a spline defined by

.. note::

by Benland100

Example:

.. code-block:: pascal



*)
procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
lastX, lastY: integer;
sqrt2, sqrt3, sqrt5: extended;
begin
try
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
wait(round((maxWait - minWait) * (step / maxStep) + minWait));
lastdist:= dist;
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
except
end;
end;


Procedure DragUp;
var randomScroll: integer;
begin
randomScroll := RandomRange(100, 150);
* if(FindColorTolerance(x, y, 3911923, 230, 210, 232, 290, 20)) then
* begin
* * Holdmouse(x, y, mouse_left);
* * wait(random(150));
* * WindMouse();
* *// wait(random(150));
* * ReleaseMouse(x, y-randomScroll, mouse_left);
* end else
* begin
* * if(FindColorTolerance(x, y, 3911923, 229, 90, 231, 110, 20)) then
* * begin
* * * Holdmouse(x, y, mouse_left);
* * * wait(random(150));
* * * WindMouse();
* * // *wait(random(150));
* * * ReleaseMouse(x, y+randomScroll, mouse_left);
* * end;
* end;
end;

This looks human like + allows for slight pixel change :)

Laimonas171

2012-12-04 11:13:39

From: xtrapsp
Well if you want it to look more human like think of it like this,

MMouse can be replaced with Windmouse ;) That means you get a slight bit of x axis being thrown of (Which does happen, people do move their mouse up and a little left or right).

for the hold and release thats fine :)

(*
WindMouse
~~~~~~~~~

.. code-block:: pascal

procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);

Moves the mouse along a spline defined by

.. note::

by Benland100

Example:

.. code-block:: pascal



*)
procedure WindMouse(xs, ys, xe, ye, gravity, wind, minWait, maxWait, maxStep, targetArea: extended);
var
veloX, veloY, windX, windY, veloMag, dist, randomDist, lastDist, step: extended;
lastX, lastY: integer;
sqrt2, sqrt3, sqrt5: extended;
begin
try
sqrt2:= sqrt(2);
sqrt3:= sqrt(3);
sqrt5:= sqrt(5);
while hypot(xs - xe, ys - ye) > 1 do
begin
dist:= hypot(xs - xe, ys - ye);
wind:= minE(wind, dist);
if dist >= targetArea then
begin
windX:= windX / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
windY:= windY / sqrt3 + (random(round(wind) * 2 + 1) - wind) / sqrt5;
end else
begin
windX:= windX / sqrt2;
windY:= windY / sqrt2;
if (maxStep < 3) then
begin
maxStep:= random(3) + 3.0;
end else
begin
maxStep:= maxStep / sqrt5;
end;
end;
veloX:= veloX + windX;
veloY:= veloY + windY;
veloX:= veloX + gravity * (xe - xs) / dist;
veloY:= veloY + gravity * (ye - ys) / dist;
if hypot(veloX, veloY) > maxStep then
begin
randomDist:= maxStep / 2.0 + random(round(maxStep) div 2);
veloMag:= sqrt(veloX * veloX + veloY * veloY);
veloX:= (veloX / veloMag) * randomDist;
veloY:= (veloY / veloMag) * randomDist;
end;
lastX:= Round(xs);
lastY:= Round(ys);
xs:= xs + veloX;
ys:= ys + veloY;
if (lastX <> Round(xs)) or (lastY <> Round(ys)) then
MoveMouse(Round(xs), Round(ys));
step:= hypot(xs - lastX, ys - lastY);
wait(round((maxWait - minWait) * (step / maxStep) + minWait));
lastdist:= dist;
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));
except
end;
end;


Procedure DragUp;
var randomScroll: integer;
begin
randomScroll := RandomRange(100, 150);
* if(FindColorTolerance(x, y, 3911923, 230, 210, 232, 290, 20)) then
* begin
* * Holdmouse(x, y, mouse_left);
* * wait(random(150));
* * WindMouse();
* *// wait(random(150));
* * ReleaseMouse(x, y-randomScroll, mouse_left);
* end else
* begin
* * if(FindColorTolerance(x, y, 3911923, 229, 90, 231, 110, 20)) then
* * begin
* * * Holdmouse(x, y, mouse_left);
* * * wait(random(150));
* * * WindMouse();
* * // *wait(random(150));
* * * ReleaseMouse(x, y+randomScroll, mouse_left);
* * end;
* end;
end;

This looks human like + allows for slight pixel change :)


Thank you, by the way, just noticed after update, it leave last smelthed item selected so no need to do that each time.. like it was after EoC update first few days