Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
Java internal mouse?
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 01-17-2012, 05:34 AM
Newcomer
 
Join Date: Jan 2012
Posts: 2
Default Java internal mouse?

Ok so i created this bot which auto alchs for me and logs out.
I'm really frustrated on how to make it use a 2nd mouse say to speak.
I've heard you can use reflection if you use the correct loaders but i'm not too familiar with reflection so...ye

Here is the code help will be appreciated

Code:
package com.xero.macros;

import java.awt.AWTException;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.PointerInfo;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.io.IOException;
import java.net.URL;

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.UIManager;

import com.xero.Logger;
/**
 * 
 * @author Tyler(Arravs flow , skrillex etc on diff forums)
 *
 */
public class Alcher extends JFrame {
	/**
	 * 
	 */
	private static final long serialVersionUID = -8286155230324582877L;
	public static int alchs = 0;
	Graphics g1;
	public int alchTo = 100;
	private JPanel contentPane;
	private JTextField textField;
	public static Dimension size;
	Robot robot = new Robot();
	public boolean mageTab = false;
	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			
			public void run() {
				try {
					
					
					UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");
					Alcher frame = new Alcher();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
	/**
	 * Create the frame.
	 * @throws AWTException 
	 * @throws IOException 
	 */
	public Alcher() throws AWTException, IOException {
		setResizable(false);
		size = Toolkit.getDefaultToolkit().getScreenSize();
		setTitle("Alcher Pro");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 174, 140);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		setLocation(
        (int)(size.getWidth()-contentPane.getWidth())/2,
        (int)(size.getHeight()-contentPane.getHeight())/2);
		JLabel lblEnterAmount = new JLabel("Enter Amount:");
		lblEnterAmount.setBounds(44, 11, 83, 27);
		contentPane.add(lblEnterAmount);
		textField = new JTextField();
		textField.setBounds(0, 32, 166, 27);
		contentPane.add(textField);
		textField.setColumns(10);
		JButton btnStartAlching = new JButton("Start Alching");
		btnStartAlching.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				 Logger.log("Alcher Pro", "Alching Pro Started!");
				 try {
					click();
				} catch (InterruptedException e1) {
					e1.printStackTrace();
				}
			}
		});
		btnStartAlching.setBounds(0, 83, 166, 23);
		contentPane.add(btnStartAlching);
		
		JLabel lblRedemptionBotting = new JLabel("Redemption Botting");
		lblRedemptionBotting.setBounds(30, 70, 136, 14);
		contentPane.add(lblRedemptionBotting);
	}
	public void click() throws InterruptedException {
		int many = Integer.parseInt(textField.getText());
		if(alchs == many) {
			ranOutOfAlchs();
			Logger.log("Alcher Pro","---------------------");
			Logger.log("Alcher", "Completed Alching, logging out!");
			Logger.log("Alcher Pro","---------------------");
			Thread.sleep(2000);
			System.exit(0);
		}
		for (int i = 0; i < many; i++) {
			try {
				robot.mousePress(MouseEvent.BUTTON1_MASK);
				robot.mouseRelease(InputEvent.BUTTON1_MASK);
				robot.mousePress(InputEvent.BUTTON1_MASK);
				robot.mouseRelease(InputEvent.BUTTON1_MASK);
				robot.mouseMove(866,400);
				Thread.sleep(4000);
				alchs++;
				Logger.log("Alcher Pro", "Alch number: "+alchs);
			} catch (InterruptedException e) {
				e.printStackTrace();
				System.exit(0);
			}
		}
	}
	
	public void SmoothMove(Point Destination, double Speed){
		//Credits to Flaming Idiots for this as well, it was only converted to Java by SlashShot
   		try {
	   		Robot robot = new Robot();
	   		PointerInfo PInfo = MouseInfo.getPointerInfo();
			Point origin = PInfo.getLocation();
	   		Point Difference = new Point((int)(Destination.getX() - PInfo.getLocation().getX()),(int)(Destination.getY() - PInfo.getLocation().getY()));	

			
			for(double Current = 0; Current < 1; Current+= (Speed/Math.sqrt(Math.pow(Difference.getX(),2) + Math.pow(Difference.getY(),2)))){
				PInfo = MouseInfo.getPointerInfo();
				robot.mouseMove((int)origin.getX() + (int)(Difference.getX() * Current),(int)origin.getY() + (int)(Difference.getY() * Current));
				robot.setAutoDelay(3);
			}
		}catch(java.awt.AWTException exc) {
			System.out.println("error");
		}
	}
    public Point FindPixelByColor(Rectangle Window, Color Colour)
    {
        try
        {
            Robot Robot = new Robot();
            for(int x = Window.x; x < Window.width; x++)
                for(int y = Window.y; y < Window.height; y++)
                    if(Robot.getPixelColor(x, y).getRGB() == Colour.getRGB())
                        return new Point(x, y);
        }
        catch(Exception Exception)
        {
            Exception.printStackTrace();
        }
        return null;
    }

	public void ranOutOfAlchs() throws InterruptedException {
		robot.mouseMove(1060,35);
		robot.mousePress(InputEvent.BUTTON1_MASK);
		robot.mouseRelease(InputEvent.BUTTON1_MASK);
		Thread.sleep(1500);
		robot.mouseMove(900,380);
		Thread.sleep(1500);
		robot.mousePress(InputEvent.BUTTON1_MASK);
		robot.mouseRelease(InputEvent.BUTTON1_MASK);
	}
}
Reply With Quote
  #2  
Old 01-17-2012, 06:02 AM
Guru
 
Join Date: Jan 2007
Location: /home/Canada
Posts: 1,768
Default Re: Java internal mouse?

Using more than one mouse is not simple because then you have to actually load the applet into your program and perform all the mouse actions through Java itself and this means the mouse only interacts with the Java frame not the rest of your screen.

The robot class mouse actions you are using actually get transformed to operating system specific mouse input calls and that's why they take effect outside of the Java application as well.

If you just want to alch with a second bot at the same time then just modify your program slightly to alternate between alching for multiple windows. i.e. clicking on the first, then the second, then the first, and so on.

Also, letting yourself specify the coordinates on startup somehow would help too because you could just put in 2 sets for it to alternate between. (one set for each character logged in)
Reply With Quote
  #3  
Old 01-17-2012, 01:34 PM
The Black Tux's Avatar
Only Skype: TBT_Sythe | Always Request a PM!
Java Programmers The Black Tux Donor Sythe Verified User
 
Join Date: Apr 2009
Location: Colombia
Posts: 5,808
Send a message via Skype™ to The Black Tux
Sythe Donations Bond Holder
Default Re: Java internal mouse?

This is for RS botting?

I suggest either using an source of a client and add your clicker (Still needs lots of modification) or a current bot like JBot
__________________
The Paypal Blacklist
1100+ Vouches - OMM Service
"It is hard to believe that a man is telling the truth when you know that you would lie if you were in his place."
OMM | MM of 2011 & 2012 | Most Helpful User of 2011 | Former OGV | Former CA | 2x Most Community-Involved MotM

Last edited by The Black Tux : 01-17-2012 at 01:34 PM.
Reply With Quote
  #4  
Old 01-17-2012, 02:54 PM
Newcomer
 
Join Date: Jan 2012
Posts: 2
Default Re: Java internal mouse?

Quote:
Originally Posted by The Black Tux View Post
This is for RS botting?

I suggest either using an source of a client and add your clicker (Still needs lots of modification) or a current bot like JBot
Well if i used that there would have to be a lot of modification since the cluster fluter bs caused a lot of changes in the code.

Also i have a loader just i'll have to load the applet in in like he said. :\
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 08:01 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1