Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Bug Mouse.getTarget() and player.getTarget() returning null;

Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
Not much explaining to do, both of these return null (atleast for gameobjects)
For the player.getTarget() I used devToolkit and saw that when woodcutting player.getTarget never shows the tree

For Mouse.getTarget() i used code which also only returns null (even when forcing my mouse on an object)

Code:
nteractable mouseTarget = Mouse.getTarget();
        bot.getLogger().debug("Mouse target: "+mouseTarget);
        if (mouseTarget != null) {
            ........
        }
        bot.getLogger().debug("No target");
resulting log:
00:04:32 DEBUG Trying to hover mouse over Deposit chest [2759, 2695, 0]
00:04:35 DEBUG Mouse target: null
00:04:35 DEBUG No target
00:04:35 DEBUG Trying to hover mouse over Deposit chest [2759, 2695, 0]
00:04:38 DEBUG Mouse target: null
00:04:38 DEBUG No target
00:04:38 DEBUG Trying to hover mouse over Deposit chest [2759, 2695, 0]
00:04:41 DEBUG Mouse target: null
00:04:41 DEBUG No target
00:04:41 DEBUG Trying to hover mouse over Deposit chest [2759, 2695, 0]
00:04:44 DEBUG Mouse target: null
00:04:44 DEBUG No target
 
Engineer
Joined
Jul 28, 2013
Messages
2,776
Actor#getTarget() only works for other Actors. Mouse#getTarget only returns the target it's moving towards, so it'll always return null if you're not checking it from a seperate thread.
 
Niche bots at your disposal
Joined
Dec 23, 2015
Messages
1,104
Yeah i was looking at superinterfaces in the docs and not subinterfaces for actor :/. And ok I'll have to rethink how i use Mouse.getTarget()
 
Top