Thread: [Java] Auto Clicker

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 [Java] Auto Clicker 
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    82
    Thanks received
    54
    Rep Power
    0
    This topic is entirely homosexual.
    Reply With Quote  
     

  2. #2  
    Registered Member
    ViperSniper's Avatar
    Join Date
    Apr 2007
    Age
    20
    Posts
    2,419
    Thanks given
    372
    Thanks received
    88
    Rep Power
    976
    final's should be Capitals like:
    dontLeech should be DONTLEECH
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Oct 2008
    Posts
    842
    Thanks given
    82
    Thanks received
    54
    Rep Power
    0
    Quote Originally Posted by ViperSniper View Post
    final's should be Capitals like:
    dontLeech should be DONTLEECH
    Why does it matter? It still works the same.
    Reply With Quote  
     

  4. #4  
    Banned

    Join Date
    Jul 2008
    Age
    18
    Posts
    5,831
    Thanks given
    1,304
    Thanks received
    198
    Rep Power
    0
    Uncompiled code, no imports
    Code:
    public class Clicker {
    
    	private final long delay;
    	private int numClicks;
    
    	//Enter -1 for continuous.
    	public Clicker(long delay, int numClicks) {
    		this.delay = delay;
    		this.numClicks = numClicks;
    	}
    
    	public void startClicks() throws InterruptedException, AWTException {
    		Robot r = new Robot();
    		while(numClicks == -1 || numClicks-- > 0) {
    			long start = System.currentTimeMillis();
    			try {
    				clickMouse(r);
    
    			} finally {
    				long time = delay - (System.currentTimeMillis() - start);
    				if(time > 0L) {
    					Thread.sleep(delay);
    				}
    			}
    		}
    	}
    
    	private void clickMouse(Robot mainBot) {
    		mainBot.mousePress(InputEvent.BUTTON1_MASK);
    		mainBot.mouseRelease(InputEvent.BUTTON1_MASK);
    	}
    }
    Reply With Quote  
     

  5. #5  
    Banned

    Join Date
    Feb 2007
    Age
    22
    Posts
    3,020
    Thanks given
    24
    Thanks received
    207
    Rep Power
    0
    Quote Originally Posted by Colby View Post
    Uncompiled code, no imports
    Code:
    public class Clicker {
    
    	private final long delay;
    	private int numClicks;
    
    	//Enter -1 for continuous.
    	public Clicker(long delay, int numClicks) {
    		this.delay = delay;
    		this.numClicks = numClicks;
    	}
    
    	public void startClicks() throws InterruptedException, AWTException {
    		Robot r = new Robot();
    		while(numClicks == -1 || numClicks++ > 0) {
    			long start = System.currentTimeMillis();
    			try {
    				clickMouse(r);
    
    			} finally {
    				long time = delay - (System.currentTimeMillis() - start);
    				if(delay > 0L) {
    					Thread.sleep(delay);
    				}
    			}
    		}
    	}
    
    	private void clickMouse(Robot mainBot) {
    		mainBot.mousePress(InputEvent.BUTTON1_MASK);
    		mainBot.mouseRelease(InputEvent.BUTTON1_MASK);
    	}
    }
    L2 numClicks-- > 0
    Reply With Quote  
     

  6. #6  
    An bot
    Guest
    while(numClicks == -1 || numClicks++ > 0) the ****?
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Jul 2008
    Age
    18
    Posts
    5,831
    Thanks given
    1,304
    Thanks received
    198
    Rep Power
    0
    Quote Originally Posted by Zee Best View Post
    L2 numClicks-- > 0
    Yeah that should be -- not ++. My bad.

    Quote Originally Posted by An bot View Post
    while(numClicks == -1 || numClicks++ > 0) the ****?
    //Enter -1 for continuous.
    Reply With Quote  
     

  8. #8  
    An bot
    Guest
    Quote Originally Posted by Colby View Post
    Yeah that should be -- not ++. My bad.
    numClicks++ > 0 as zee pointed out.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Nov 2007
    Age
    20
    Posts
    519
    Thanks given
    1
    Thanks received
    3
    Rep Power
    73
    Quote Originally Posted by tucybro View Post
    Got bored a couple of days ago.. Got so lazy I couldn't even be bothered clicking LOL. So in the end I decided to make myself an auto clicker. So enjoy.

    Code:
    mport java.awt.Robot;
    import java.awt.event.InputEvent;
    import java.util.*;
    
       public class Engine {
       
          private static Robot mainBot;
          private int mouseClicks = 0;
          private long OldTime = System.currentTimeMillis();   
          
          private int clickTimer = 5000;
          
          public void clickMouse() {
             mainBot.mousePress(InputEvent.BUTTON1_MASK);
             mainBot.mouseRelease(InputEvent.BUTTON1_MASK);
          }
          
          public void startBot() {
             while(true) {
          
                if(System.currentTimeMillis() - OldTime > clickTimer) {   
                   OldTime = System.currentTimeMillis();
                   clickMouse();
                   mouseClicks++;
                   System.out.println("Mouse Clicked #" + mouseClicks);
                }
             
             }
          }
          
          public Engine() {
          
             System.out.println("Welcome to the Java AutoClicker V" + Constants.version + " created by " + Constants.dontLeech + ".");
             
             Scanner sc = new Scanner(System.in);
             System.out.print("(Seconds) AutoClicker timer:");
             clickTimer = Integer.parseInt(sc.nextLine()) * 1000;
             System.out.println("Clicking every " + clickTimer / 1000 + " seconds.");      
             
             startBot();
          }
          
          public static void main(String args[]) {
          
             try {
                mainBot = new Robot();
             } catch(Exception e) {
                System.out.println("Error: Autoclicker failed to start!");
             }
             
             new Engine();
          }
       
       }
    Code:
       public class Constants {
       
          public static final String dontLeech = "Luke";
          public static final String version = "1.0";
       
       }
    The only other site u should see this on is the Sythril website.

    Enjoy .
    Response to why it matters to capitalize constants: Conventions.
    Spoiler for Show GIFs:

    Reply With Quote  
     

  10. #10  
    Banned

    Join Date
    Dec 2008
    Posts
    4,237
    Thanks given
    388
    Thanks received
    413
    Rep Power
    0
    hmm I'd leech that
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •