-
Member
Make your own Bot with Java Robot Class
Dear forumpeople,
Noticing I couldnt buy my way to the top I thought it might be a nice idea to give something to the community that I can provide.
I have been making my own bots for wow for as long as it's around and one of the easiest ways to make em was using the Java Robot class. It is almost impossible to detect a bot made with the robot class because you just type some random things and you couldve done that yourself.
You dont hack your way into memory or whatsoever, and since you made em yourself Blizzard wont notice a signature, because your application will always differ from big releases as Glider etc...
What do you need?
What is the JAVA Robot class
The java Robot class is a class that can easily make use of your keyboard and mouse and read out the circumstances you might wanna create for em (Like pixelcolor and mouseposition).
Read more about it. and read which awesome moves your robot can make here: Robot (Java 2 Platform SE v1.4.2)
What can you use it for
All sorts of bots like:
- - a fishing bot (Go to the pixel with your bobber color and rightclick as soon as you hear the spalsh wav and recastthe button with fishing in your actionbar.
- - An afk bot. Walk around the farm / stables hitting random instants /jumps and tabs for example.
- - Spambots / whateverobots.
What can't you use it for?
Speedhacks, flyhacks, tracking etc....
Ok, how does it work?
Well, after you installed the sdk and jCreator. Make a new file called myBot.java .
When you compile / run this myBot.java the compiler creates myBot.class and this is your actual bot. You can run it using jCreator or from commandline.
Ok: now the code....
First import the following packages, you need them coz thats where the robot class lives.
Code:
import java.awt.*;
import java.awt.event.*;
Then open and close your class. A constructor is not necessary. easypeasy mode. Within public static.... you construct your own Robot called myRobot.
Code:
public class myBot{
public static void main(String[] args)
throws AWTException{
Robot myRobot = new Robot();
}
}
Woohoo, you did it, you have your own robot. Now lets add some fancy stuff to him... To make him do something you can use the functions on Robot (Java 2 Platform SE v1.4.2). For example, if you wanna make the robot go to pixel 500,500 in your screen you call call out the next line and he will do so.
Code:
myRobot.mouseMove(500,500);
Ok next a complete example code which makes your robot move your mouse downwards. Useless but it shows how easy it is to make a bot like that. It will stop after a few seconds so dont worry :d
Code:
import java.awt.*;
import java.awt.event.*;
public class myBot{
public static void main(String[] args)
throws AWTException{
Robot myRobot = new Robot();
for(int i = 0; i<100; i++){
myRobot.delay(100);
myRobot.mouseMove(1005,i);
}
}
}
See: it goes a pixel down every 0.1 seconds (The delay is in ms).
Use the general ideas on top to make your own fishbots etc... It's easy and you'll learn along the way.
Im not going to hand out the codes i made so dont ask for em please, but I will try to answer questions in this thread.
One more tip: Use Random() in your delay, makes you way less suspicious.
Greetings,
Last edited by whappit; 03-24-2009 at 10:52 AM.
-
Post Thanks / Like - 2 Thanks
-
Banned
Good guide, Java has a lot of potential. I'd say making a bot in Java is a good choise ) But... don't ask for rep.
-
Member
agreed, took it off.
-
Member
Ha, nice to see I am not the only one struggling with Java to make some Bots :yuck:
You forgot to mention 1 important aspect of the Robot Class besides Mouse/Keyboard Simulation: The ability to create Screenshots! :woot2:
Some ideas of what I have done with Java in the past 1.5 - 2 years:
Fishing Bot
It was the first "Bot" I have ever written in Java for WoW. It was able to cast the fishing spell, loot the bobber but also to apply lures to your fishing pole. Basically it performed the following steps:
- Cast the spell
- Create screenshot and search for bobber pixel color
- Repeatively create screenshots on the found position and wait until it the color changes significantly
- Move the mouse to the position and Shift-RightClick
- Start from 1)
This worked quite smoothly, was independent from any WoW Versions/Patches and brought my Fish-Skill to the Max-Level easily.
Complete Farm Bot
After the fishing bot, I wanted to create a more sophisticated bot. Therefore I had to create a small WoW-Addon written in LUA which extracted some interesting data from WoW (like my position, health, mana, the selected target, etc...) and represented this data as colored pixels on the left-top screen corner. Thus I was able to read this data with Java again and had several information about the game without any memory-hooks.
Together with the gathered information I created at the beginning a "traveling-bot" to avoid anoying running around while doing my quests. Especially on lower levels this was quiet helpful.
After some time I started to improve the Bot and added Fighting & Looting functionalities and it become a useful Farming/Leveling-Bot. Even after that I added a functionality which allowed to perform some PvP-Honor-Farming. Therefore the bot automatically joined Battelgrounds, ran around, attacked enemies randomly and so on.
So even with a basic aidea, you could create a real sophisticated Bot in Java. Just take it slow and step by step
Complete Bot using packets
This was the last project I started end of last year. I created a proxy to sniff WoW packets from the wire. It used a quiet know algorithm to break the Session-Key which encrypts/decrypts the packets header (you can also read that key from the memory if you have a client running). After a while the proxy was able to read / create most of the necessary packets used in the game. I started with a packet-based fishing bot by reading and emulating packets. Then I played around by altering packets to avoid falling damage and so on. Even complete client-less bots are possible this way. I never really started to create a complete Bot with the packet sniffing approach as I stopped playing and therefore coding a while ago.
Anyways, this should give all of you a fairly good idea of what is possible, when writing Bots with Java. There are endless capabilities and don't let anyone tell you differently!!!!
(And if Java itself is not enough and you need Memory-Access, you might use some open libraries like JNA or JNative. I used those successfully for example to read my players location directly from the memory.)
Kind regards and happy coding,
Frikos
-
Member
Hey Frikos,
Thanks for your reply. It indeed filled the gaps in my article I was a titbit too lazy too type out all the posibilities, so I decided to point out to the API, hoping that people would actually try to learn something .
Im very happy you pointed me towards JNATIVE. I worked out a way to read out data from memory myself, but this makes everything easier.
I was never happy with getPixelColor to find the bobber or anything, it just didnt work exactly right. Now I have new posibilities.
Thanks for your insights, Ill go fiddle around and maybe release some of my work here in the near future.
-
Active Member
was going to rep till i saw this
Originally Posted by
Y R U A NUB ?
Good guide, Java has a lot of potential. I'd say making a bot in Java is a good choise ) But... don't ask for rep.
-
Member
Well here i mostly prefer my own homemaked AutoIT fish bot ;D I altso choose the color it has to click on .. so I catch all the time my own fish ;P
Have a nice day
The CyberSpace will cover the future of AutoIT!
Maxmaximuss2.
-
Member
Hey man,
Thanks... Im so excited to start trying things out... Can I ask you for advise if I struggle?
PS: Ill try to rep, the guide seems worth it i'd say, just let em nag ;-)
-
Member
Making a fishing bot in Java would be incredible awesome.
It would mean that it would be cross-platform, so Linux users could use it as well!
Please, somebody make a bot in Java, and keep it open source
-
Member
This is awesome. I've just started diving into Java to create web apps. (been working with coldfusion previously). This could provide a lot of weekend fun.. haha. Thanks for the post!
-
Excellent guide, I might start using Java now! +Repx5
Edit: "Sorry you cannot give reputation to this post" :/ I wonder why not.
Last edited by ReidE96; 06-24-2009 at 03:13 PM.
-
Member
Really awesome dude, helped me out alot + rep!
Account Scammed 106
Gold Scammed: 1 7268
Euro Scammed: 460€
-
Knight-Champion
I've read Swedish Programming A+B in High School in JAVA. So I'll definately give this a try for learning purposes, and with the final result, I'll release it to MMOwned =)
Now I am at work but when I come home I'll be programming my ass off!
+rep for sure!
-
Member
Thanks to you, I've decided to start a bit Java botting, and I've made a few snippets which hopefully could help some of you guys out as well.
Press(int a) is used for pressing a button, much simpler than writing doing KeyPress and KeyRelease each time.
public static void Press(int a){
myRobot.keyPress(a);
myRobot.delay(100); //Not needed, just used for more human-like actions.
myRobot.keyRelease(a);
}
Almost same as Press(int a) except that it holds the button down for longer time, can be used for making more human-like writing. (See Say())
public static void Press(int a, int time){
myRobot.keyPress(a);
myRobot.delay(time);
myRobot.keyRelease(a);
}
Say() is used for talking in WoW, can be used for spambotting or talking while fish botting.
public static void Say(String a){
//START CHAT WINDOW
Press(KeyEvent.VK_ENTER); //PRESS ENTER
for(int i=0; i<a.length(); i++){
Press(((int)a.charAt(i)), 100);
}
Press(KeyEvent.VK_ENTER);
}
Whisper() is much similar to Say(), except that it presses R so it whispers back. (No detection for whispers though)
public static void Whisper(String a){
//START WISPER BACK
Press(KeyEvent.VK_R);
for(int i=0; i<a.length(); i++){
Press(((int)a.charAt(i)), 100);
}
Press(KeyEvent.VK_R);
}
MouseWheel() is used for zooming in on character when fishing. 1 negative amount is 1 notch with the wheel. So -100 is 100 notches away from you (pointing against the monitor).
public static void MouseWheel(){
myRobot.mouseWheel(-100);
}
LogOut() is used for logging out (obvious). I've just tested the console command /logout in WoW, and it works perfectly.
public static void LogOut(){
Say("I have go now, dads yelling at me >_>. Bye."); //Safety perhaps?
myRobot.delay(2500); //Wait 2,5 seconds before logging out. More human-like.
Say("/logout");
myRobot.delay(25000); //Waits 25seconds before doing continuing. This is only needed if not in city.
}
Start of pixel detection:
This does not scan, it's only a start. This was only used for testing it out a bit, and it works good to testing if the current mouse position is a white pixel.
public static void Scan(){
int R=255;
int G=255;
int B=255; // 255, 255, 255 = white.
//GET MOUSE LOCATION
int nX = MouseInfo.getPointerInfo().getLocation().x; //Get location
int nY = MouseInfo.getPointerInfo().getLocation().y; //Get location
//GET PIXEL COLOR OF nX AND nY
c = myRobot.getPixelColor(nX, nY);
//CHECK TO SEE IF THEY MATCH WITH R G AND B
if ((c.getRed()==R) && (c.getGreen()==G) && (c.getBlue()==B)){
System.out.println("Found bobber, waiting for change of pixel color");
}
else
{
System.out.println("Couldnt find bobber");
}
}
I've also found a very nice source code for a Final Fantasy fishing bot, which can be usefull. I've used some of it, so credits to that guy.
www.penguinpeepshow.com/assets/fishing_bot.java
Last edited by Molleren; 07-09-2009 at 07:52 AM.
-
Member
Originally Posted by
frikos
Complete Farm Bot
After the fishing bot, I wanted to create a more sophisticated bot. Therefore I had to create a small WoW-Addon written in LUA which extracted some interesting data from WoW (like my position, health, mana, the selected target, etc...) and represented this data as colored pixels on the left-top screen corner. Thus I was able to read this data with Java again and had several information about the game without any memory-hooks.
Together with the gathered information I created at the beginning a "traveling-bot" to avoid anoying running around while doing my quests. Especially on lower levels this was quiet helpful.
After some time I started to improve the Bot and added Fighting & Looting functionalities and it become a useful Farming/Leveling-Bot. Even after that I added a functionality which allowed to perform some PvP-Honor-Farming. Therefore the bot automatically joined Battelgrounds, ran around, attacked enemies randomly and so on.
So even with a basic aidea, you could create a real sophisticated Bot in Java. Just take it slow and step by step
Kind regards and happy coding,
Frikos
hey u think u could send me that addon? im not so great with LUA but im pretty good with Java so i want to give it a shot if u can, thx if u cant i guess im SOL lol