JAVA. Bypassing servers/connecting your exe question

Posts: 2
Joined: 2010.06
Post: #1
EDIT: ok im not trying to figure out how to connect to server with the exe etc., i am stuck on trying to figure out how to use key press. i have so far been able to detect what key is pressed, but im trying to find out how to repeat the key pressed.

for ex, i press 3, (inside code if 3 is pressed, press 3 ten more times)

what exactly am i looking for to make the program repeatedly press w.e the user input was? i can only reprint the input, but cannot mimic it :/

any help or direction is appreciated thnx. i tried googling but all i found was examples of key pressed/ event/ listener etc., nothing about repeating the key automatically.

is there perhaps something like:

if(i == '3'){
keyPress(i); <-- a method or sumthin?

thnx a lot.
Quote this message in a reply
Posts: 484
Joined: 2008.04
Post: #2
I'm guessing that an "autopot" is some sort of an automatic game playing program, like Glider for WoW... So I'll base my response off that assumption.

In general, it's rather difficult to insert your code into another program to determine when how you should respond to a certain situation. Key/Button listeners aren't generally sufficient for responding to input from a game. Most of those sorts of programs actually scrape the screen and process the info.

If you're just making some sort of a macro system... where you can push a key to trigger a bunch of keystrokes, I'd recommend making an applescript script to do that- I've made building macros for Dwarf Fortress that way.

A little googling has directed me towards the Java Robot class:

Apparently that does exactly what you want to do. it will even send keystrokes and control the mouse in non-java apps.

Not sure what platforms it works on.

Depending on exactly what you end up doing (such as decompiling a program to inject new code), you might want to look into legal issues:

And also legal issues around game automation and breaking EULAs, such as:

Howling Moon Software - CrayonBall for Mac and iPhone, Contract Game Dev Work
Quote this message in a reply
Posts: 2
Joined: 2010.06
Post: #3
thnx, the robot class was a BIG help. exactly what i looking for
Quote this message in a reply
Post Reply