• Log in or sign up for an account here: https://www.sythe.org/login

Speed clicker help.

Claximillions

Active Member

Banned
Joined
Mar 27, 2010
Sythe Gold
0
Messages
166
Location
Runescape Market
Hey, I'm trying to make a script.
This isn't for runescape, but it's gotten me confused beyond words.


I'm trying to make a script that clicks fast when ever I have my left mouse button down.

What code would I have to put in order for it to only go while left mouse button is down?

I've tried a lot of things... Ask for my code if needed.
 
There is a problem using the button you are pressing to activate the script and also being pressed by the script. It doesn't know the difference between a physical press and a script press and it messes with the logic.

To get around this, use the Right mouse button to trigger a rapid fire on the Left mouse button.

Don't set a target window in SCAR, and use Ctrl-Alt-R to start the script and Ctrl-Alt-S to stop it. When you want to rapid fire on the Left mouse button, click the Right mouse button ;)

Code:
program New;
var
x,y:Integer;
begin
While 1 <> 0 do //Infinite loop
 While IsMouseButtonDown(False) do
  begin
  GetMousePos(x,y);
  ClickMouse(x,y,True);
  Sleep(50);
  end;
end.
 
this is where you tell me what IS free, what would be ok to use to trigger a rapid left click other than the left mouse button itself..

any key on your keyboard can be used.

Code:
program New;
var
x,y:Integer;
begin
While 1 <> 0 do //Infinite loop
 While IsKeyDown(chr(32)) do //Space Bar
  begin
  GetMousePos(x,y);
  ClickMouse(x,y,True);
  Sleep(50);
  end;
end.

Other functions you could replace IsKeyDown and IsMouseButtonDown with
function IsFunctionKeyDown(Key: Byte): Boolean; - Checks if the given function key is down.
Meanings of Key:
0: SHIFT
1: CONTROL
2: ALT
3: LEFT SHIFT
4: LEFT CONTROL
5: LEFT ALT
6: RIGHT SHIFT
7: RIGHT CONTROL
8: RIGHT ALT

function IsFKeyDown(Num: Byte): Boolean; - Num = 1..12. Checks if F1, F2, ... F11 or F12 key is down corresponding to Num.

function IsArrowDown(Num: Byte): Boolean; - Checks if arrow key is down. Num corresponds to 0 = up, 1 = right, 2 = down, 3 = left.

function IsKeyDown(C: Char): Boolean; - Checks if the given key is down.
Example:
if(IsKeyDown('a'))then
Writeln('You have pressed "a". Congratulations!');

You could also use a combination of key+mouse click to trigger it.
The following uses CTRL+Left Click. You must hold down CTRL and click the mouse to trigger it, let go of CTRL when you want it to stop.
You'll notice what I mean about the problem of the script not knowing the difference between your clicks and its own clicks.. The condition for it to keep clicking is that the CTRL button is held down AND the left mouse button is held down, but you can release the left mouse button while still holding CTRL and it will still happily click away, because its own scripted clicking is taking the place of you holding down the mouse button so the script still thinks the mouse button is down (but its not).

Code:
program New;
var
x,y:Integer;
begin
While 1 <> 0 do //Infinite loop
 While (IsFunctionKeyDown(1) and (IsMouseButtonDown(True))) do
  begin
  GetMousePos(x,y);
  ClickMouse(x,y,True);
  Sleep(20);
  end;
end.

Would be easier if I knew what this was for so I could understand what you want and what would best suit. If this is for some game that can use bindings, bind the fire button to the scrollwheel of your mouse ;)

Enjoy.
 
Well you can't use the left mouse button to trigger it by holding it down.

When you click the mouse, a MouseDown event is sent to a message handler, when you release the button a MouseUp event is sent.
When the script does a ClickMouse it sends a MouseDown and then a MouseUp.

So when you hold the button down, after a ClickMouse the computer thinks you've let go of the mouse button.

A work around is to use the left mouse button to start the script, then the left mouse button again to stop it.

Code:
program New;
var
x,y:integer;
begin
While IsMouseButtonDown(True) do; //Clear any phantom clicks
While 1 <> 0 do //Infinite loop
 begin
  If IsMouseButtonDown(True) then
   begin
    Repeat
     GetMousePos(x,y);
     ClickMouse(x,y,True);
     While IsMouseButtonDown(True) do; //Clear MouseDown event
     Sleep(20); //Adjust for speed of rapid fire clicking
    Until IsMouseButtonDown(True); //Check for second click
    Sleep(200); //Quick click to stop
   end;
 end;
end.

If this isn't to your satisfaction, go build a hardware rapid fire mouse.
 
Runescape Gamblingrunescape gambling
Back
Top