Welcome!

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

Sign up now!

HintArrows.getLoaded().get(0) gives me an NPE

Joined
Jun 21, 2014
Messages
350
Here is the code I'm trying to use to get the falcon specific to the local player, however it always gives me an NPE. I get a java.lang.arrayindexoutofboundsexception error when it tries to run.
Code:
if (HintArrows.getLoaded() != null) {

                    HintArrow caught = HintArrows.getLoaded().get(0);
                  
                    if (caught != null) {
                        Npc caughtBird = Npcs.getLoadedAt(caught.getPosition()).first();
                        clickThing(caughtBird, "Retrieve");
                  
                }
     }
The HintArrow definitely is not null and from what I understand, 0 should be the very first loaded HintArrow, so what is causing the error?

Edit: Mostly fixed, I'm just having problems with interacting with the falcon...
 
Last edited:
Joined
Jun 21, 2014
Messages
350
If it's an ArrayIndexOutOfBoundsException then the query results are empty.
Aidden pointed this out on skype and I just made sure to check that the list wasn't empty and I was able to mostly solve my problem. I had trouble with clicking the falcon though, the results weren't empty but the script would be stuck trying to interact but wouldn't. For now I've just made falcon retrieval only activate when the HintArrow doesn't return an empty list and then just relied on clicking the closest falcon, which should prevent clicking other people's falcons in a majority of cases.
 
Joined
Dec 10, 2014
Messages
3,255
Aidden pointed this out on skype and I just made sure to check that the list wasn't empty and I was able to mostly solve my problem. I had trouble with clicking the falcon though, the results weren't empty but the script would be stuck trying to interact but wouldn't. For now I've just made falcon retrieval only activate when the HintArrow doesn't return an empty list and then just relied on clicking the closest falcon, which should prevent clicking other people's falcons in a majority of cases.

What's the NPE you said you were getting btw?
 
Top