slacky Posted January 16, 2012 Share Posted January 16, 2012 (edited) Hello. I wanted to see what you guys mean about this wierd mouse-moving function? It very simple, so, pretty much the first thing i've ported to Pascal in many many years! It purely condition based, no real math involved, it moves. The speed will differ according to it's angle (and distance). Speed might need some adjustment (Wait time at the end), and it could be made more randomized, and "smarter".. procedure SimpleMouse(x,y:Integer); var wx,wy,px,py,ax,ay:Integer; begin GetMousePos(wx, wy); repeat if(y>wy) and (x>wx) Then begin px:=x-wx; py:=y-wy; end; if(y<wy) and (x>wx) Then begin px:=x-wx; py:=wy-y; end; if(y<wy) and (x<wx) Then begin px:=wx-x; py:=wy-y; end; if(y>wy) and (x<wx) Then begin px:=wx-x; py:=y-wy; end; if(y>wy) and (x=wx) Then begin px:=x; py:=y-wy; end; if(y<wy) and (x=wx) Then begin px:=x; py:=wy-y; end; if(x<wx) and (y=wy) Then begin px:=x-wx; py:=y; end; if(x>wx) and (y=wy) Then begin px:=wx-x; py:=y; end; if(px>py) and (px<>0) and (py<>0) Then begin ax:=round(px div py); ay:=1; end; if(px<py) and (px<>0) and (py<>0) Then begin ay:=round(py div px); ax:=1; end; if(px=py) or (px=0) or (py=0) Then begin ax:=1; ay:=1; end; if(wx<x) Then wx:=wx+ax; if(wy<y) Then wy:=wy+ay; if(wx>x) Then wx:=wx-ax; if(wy>y) Then wy:=wy-ay; MoveMouse(wx,wy) wait(3+Random(3)) until(wx=x) and (wy=y); end; Meh.. ;-P Edited February 7, 2015 by slacky meh Quote Link to comment Share on other sites More sharing options...
shadowrecon Posted January 16, 2012 Share Posted January 16, 2012 The only problem i see with that function is it stops once it hits either the x or y you specified, which lets say y = 100 x = 100 well what if u hit y at 100 but ur x was at 300? then u could be within the right y but way off in the x cord? Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 16, 2012 Share Posted January 16, 2012 MMouse uses splines, the final points are randomized used RRect Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 16, 2012 Share Posted January 16, 2012 MMouse uses splines, the final points are randomized used RRect Afaik, WindMouse isn't using splines... Quote Link to comment Share on other sites More sharing options...
Wanted Posted January 16, 2012 Share Posted January 16, 2012 Well if it isn't using splines than it's certainly not using straight lines from point A to B. If you test it in MSpaint you'll see what I'm talking about Quote Link to comment Share on other sites More sharing options...
FHannes Posted January 16, 2012 Share Posted January 16, 2012 Well yes, but that doesn't necessarily mean it uses splines Benland's old mouse function used splines. Quote Link to comment Share on other sites More sharing options...
slacky Posted January 16, 2012 Author Share Posted January 16, 2012 (edited) @shadowrecon: Not all that correct. It will not work at only 45 degrees, it will always reach its destination. But my it was hard making it work correct i pascal, i had to change a lot of stuff. I might update it with a fix. It HAD a problem with moving 0 degrees.//Fixed The final point is not randomized, this can be easly done. Edit: Fixed, it became somewhat "long" since i do not know how to formulate it in pascal, and the math is ugly (Though it's correct). - My bot has been running this for 2 hours, so it should be fine. Edited January 20, 2012 by slacky Quote Link to comment Share on other sites More sharing options...