supbro123 Posted February 20, 2015 Share Posted February 20, 2015 Hey thanks for the help So basically I have this script that I just found again that auto-clicks after every random time. Originally this was a script where you put in the location you want it to click and so forth. However me being the expert I tend to be I changed it so it would click wherever the current mouse position is. But now I want it get the current mouse position, and then add some random distance from the current mouse position. So if the X cord currently was 5, I want it to have 5 + 1,10 "distance". This would just help create some randomness of where it would click. I know this is not the best explanation but I hope you get the general idea. Was wondering if anyone had any clue on how to do so Thanks! Quote Link to comment Share on other sites More sharing options...
Oort Posted February 20, 2015 Share Posted February 20, 2015 (edited) 2 ways to go about this. First is to get the mouse position, generate random numbers and then move the mouse with random numbers added on : var x,y,randx,randy:integer; begin repeat GetMousepos(x,y); while GetMouseBtnState(mbLeft) do begin Randx := randomrange(-10,10); Randy := randomrange(-10,10); movemouse(x+randx,y+randy); writeln('X: '+ inttostr(X+RandX)+' Y: '+inttostr(Y+RandY)); end; until GetMouseBtnState(mbRight); end. The second way is just to have your mouse move within a boxed area var x,y,PosX,PosY:integer; begin repeat GetMousepos(x,y); while GetMouseBtnState(mbLeft) do begin MoveMouseBox(Box(x-50, y-50, x+50, y+50)); GetMousepos(Posx,Posy); writeln('Moved the Mouse to X: '+ inttostr(PosX)+' Y: '+inttostr(PosY)); end; until GetMouseBtnState(mbRight); end. In both script cases whenever you hit the left mouse button it will move around randomly at that spot. Right click ends the script. Hope this helps. Edited February 20, 2015 by Oort Quote Link to comment Share on other sites More sharing options...
supbro123 Posted February 21, 2015 Author Share Posted February 21, 2015 MouseBox method didn't seem to work, but the first one did and I also understood where you were coming from. But now I am lost as to how I make the procedure repeat. Is this the outline? procedure Click; begin _____ end; begin Click; end. - - - Updated - - - I think the MouseBox error might have been due to me using v3.22 Quote Link to comment Share on other sites More sharing options...
Bixby Sayz Posted February 21, 2015 Share Posted February 21, 2015 Oort already gave you an example in his code with the repeat statement. repeat <DoSomething> until <SomeConditionIsTrue>; To have it repeat forever repeat Click; until False; // Will never be true Quote Link to comment Share on other sites More sharing options...
supbro123 Posted February 22, 2015 Author Share Posted February 22, 2015 Ahh funny that, never looked it that way. From the looks of it, it seems to be working smoothly. So now it will go to a random spot from within the set coordinates and click with random intervals. And once the number of clicks are greater than a random number between 5-155, the procedure Click is started again with a new set of x and y. Trying to keep it all random. Thank you guys for the help and I will most likely try make a simple one later on seeing as how I enjoyed this. Quote Link to comment Share on other sites More sharing options...
Oort Posted February 22, 2015 Share Posted February 22, 2015 Good to hear you got it going! I find scripting adds to a games re playability and decreases the mind numbing of redundant operations. Just getting the scripts to work is almost like a game unto itself Quote Link to comment Share on other sites More sharing options...