1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Detect user clicks

Discussion in 'Developer Support' started by NubeBuster, Apr 14, 2017.

  1. NubeBuster

    Joined:
    Jan 23, 2017
    Messages:
    13
    Likes Received:
    0
    I want my player to select a target ingame using the right click on it. How do I detect a user's clicks?

    Thanks
     
  2. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Implementing the mouselistener interface and adding the instance to the bot's event dispatcher.
     
    NubeBuster likes this.
  3. NubeBuster

    Joined:
    Jan 23, 2017
    Messages:
    13
    Likes Received:
    0
    Thanks for your reply!
    I got some of the code but I can't get this to work.
    So far I've got this:

    ... implements MouseListener ...

    @Override
    public void onStart(String... arg0) {
    getEventDispatcher().addListener(this);
    }

    @Override
    public void mouseClicked(MouseEvent arg0) {
    demo.logMessage(arg0.getButton() + "");
    if(arg0.getButton() == MouseEvent.BUTTON2) {
    demo.logMessage((Mouse.getTarget() == null) + "ttt");
    }
    }



    the demo.logMessage is where my output goes to but there is no output in any case.
     
  4. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    Have you added the listener to the bot's event dispatcher?
     
  5. NubeBuster

    Joined:
    Jan 23, 2017
    Messages:
    13
    Likes Received:
    0
    I did. Forgot to mention
     
  6. Savior

    Savior Java Warlord

    Joined:
    Nov 17, 2014
    Messages:
    4,906
    Likes Received:
    2,748
    i'm not sure about it but since we moved on to using the official client, the input listeners may not be supported anymore.
    @Party?
     
  7. NubeBuster

    Joined:
    Jan 23, 2017
    Messages:
    13
    Likes Received:
    0
    If that's the case I must say that this places RuneMate down many spots on the list. (starting from first place)

    (I already knew this about the paintlistener which is actually deprecated too)
    --- Double Post Merged, Apr 21, 2017, Original Post Date: Apr 14, 2017 ---
    Can someone verify this is the case?
     
  8. Jux7apose

    Joined:
    Mar 28, 2017
    Messages:
    286
    Likes Received:
    58
    Just wanted to say I don't think it's been depreciated/not supported. Fonrus's visual developer shows information of the NPC/Object/Player the user clicks.
     

Share This Page

Loading...