SRL Archive - OSR Help

Paint Mouse On SMART (FLIGHT)


YoHoJo

2012-01-11 06:46:59

How do you paint mouse onto SMART like this:
(Scroll down on there to see pictures)
http://villavu.com/forum/showthread.php?t=68701

Flight

2012-01-11 06:56:37

I simply painted a dot on smart for every mouse 'jump' in Benland's WindMouse procedure:

procedure WindMouse2(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
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;
SMART_DrawDotsEx(False, [Point(lastX, lastY)], 65280); //Here
end;
if (Round(xe) <> Round(xs)) or (Round(ye) <> Round(ys)) then
MoveMouse(Round(xe), Round(ye));

end;

Edit:
I believe there'd be a more appropriate way to do it, but this is how I did it.

YoHoJo

2012-01-11 06:58:27

So do you just copy/pate that into top of script, and still use MMouse/Mouse (like this WindMouse overwrites the SRL one?)

Or do you use the WindMouse2 instead of Mouse/MMouse?

Why WindMouse2 and not like a Mouse2/MMouse2?

Flight

2012-01-11 07:00:42

Because I used this directly in my HumanMMouse procedure. Like MMouse, it calls on WindMouse directly. So if you wanted, just make your own "MMouse" procedure and use WindMouse2 (or whatever you call the moving + painting procedure).

Brandon

2012-01-11 07:15:14

Prob not what you want.. I actually tried to draw thick lines but failed.

MMouse(MCCX, MCCY, 0, 0); /Just for testing.
GetMousePos(M.x, M.y);
P1:= Point(M.x - 5, M.Y - 5);
P2:= Point(M.X + 5, M.Y + 5);
Smart_DrawLine(True, P1, P2, CLRed);
P1:= Point(M.x + 5, M.Y - 5);
P2:= Point(M.X - 5, M.Y + 5);
Smart_DrawLine(False, P1, P2, CLRed);

Flight

2012-01-11 07:19:31

Were you wanting dot trails like what I have, YoHoJo, or line trails?

Richard

2012-01-11 08:49:32

I know that we can't obviously draw the mouse at every stage as it moves, as PascalScript can't multithread, but would there be a way of getting each of the KeyEvents for mouse moved (ie, for each pixel it moves), and to draw it then? Would be nice to see how human like the mouse is like.