Java Robot does not work in the game, does anyone know if there is a way?

Asked

Viewed 223 times

0

I recently made a bot for a game and had a problem that had occurred to me before. The code runs out of the game but when I click on the game and press to start, only the Mousemove(robot class, java ) works.

At the time, the resolution was just to run the eclipse as administrator and everything worked. I now made for another game and in this technique does not work.

I’ve isolated this code to test :

import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;

public class Clique {

    public static void main(String[] args) 
    {
        Robot auto;
         try {
                auto=new Robot();
                System.out.println("delay");
                auto.delay(5000);
                auto.mousePress(InputEvent.BUTTON1_DOWN_MASK);
                auto.delay(100);
                auto.mouseRelease(InputEvent.BUTTON1_DOWN_MASK);
            } catch (AWTException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
    }

}

And even a simple click doesn’t work( out of the game works ), someone knows what might be occurring?

OBS : this is a PC game, a MMORPG more specifically.

  • Please provide a [mvce] to test the problem. This code is not reproducible.

  • I updated the question, I think you wanted the full code.. I don’t know what 'mvce'' would be... The posted is now executable.

  • What should this code do that doesn’t? I don’t understand the problem.

  • This piece of code is part of a bot that I created for a game, this snippet should just click, is a bot method; What happens is that outside the game the method works, the click runs, but inside the game the click is ''ignored', does not work.. I see the mouse moving to the points where it should click but the click does not occur. I wonder if anyone has any opinion as to what might be causing this.. I’ve already run this separate method, without the rest of the bot, and it still doesn’t work, I think the problem isn’t the code itself.. maybe permissions.. I don’t know..

  • What game? Made in java too?

  • Allods online, do not know the language he uses, just know that has an engine itself.

  • Your example is not reproducible simply because we need this game to test. The code usually runs here. So your problem is beyond the scope of the site.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.