Jump to content

inventory.GetAmount("Coins") bugging occasionally


Recommended Posts

Posted

Hey All :) Inb4 all the "Why is the bot down" posts.

 

My question has to do with the inventory.GetAmount("Coins") statement and why some times the below getState() method sometimes returns State.A

 

Usually inventory.GetAmount("Coins") returns the correct amount, however lately when the computer lags a little it returns 0. It happens occasionally on my windows vm, but on my Linux VPS as well (and more often) that I notice has more graphical lag than my windows (but it could just be the VNC connection). 

 

I dont want to put a "&& !=0" check for the .getAmount function because it is possible that the function could return 0 and this isnt great practice in general.

 

Does everyone use this method? Has anyone run into this error before? 

if(inventory.getAmount("Coins") < 8000){
    return State.A;
}else if(inventory.isFull() || myPlayer().isUnderAttack()){
    return State.B;
}else{
    return State.C;
}
Posted (edited)

Hey All :) Inb4 all the "Why is the bot down" posts.

My question has to do with the inventory.GetAmount("Coins") statement and why some times the below getState() method sometimes returns State.A

Usually inventory.GetAmount("Coins") returns the correct amount, however lately when the computer lags a little it returns 0. It happens occasionally on my windows vm, but on my Linux VPS as well (and more often) that I notice has more graphical lag than my windows (but it could just be the VNC connection).

I dont want to put a "&& !=0" check for the .getAmount function because it is possible that the function could return 0 and this isnt great practice in general.

Does everyone use this method? Has anyone run into this error before?

if(inventory.getAmount("Coins") < 8000){    return State.A;}else if(inventory.isFull() || myPlayer().isUnderAttack()){    return State.B;}else{    return State.C;}
Where are you calling this method? Just to make sure you aren't doing something incorrect?

If you aren't then you should file a bug report

Edited by Explv
Posted

Where are you calling this method? Just to make sure you aren't doing something incorrect?

If you aren't then you should file a bug report

 

I'm calling this method so that when I dont have enough money to buy from the shop any more it trades mule. Yea I think bug report may need to happen. Just wanted to get some input first. Thanks for the reply!

Posted

I assume you are hopping a lot because you mentioned store buying.

The inventory returns null or empty sometimes as a result of the loading screen.

 

I recommend adding 

 

if (getClient().getLoginState() == LoginState.LOADING || getClient().getLoginState() == LoginState.LOADING_MAP) {
return 300;
}

To your loop :)

Posted

I assume you are hopping a lot because you mentioned store buying.

The inventory returns null or empty sometimes as a result of the loading screen.

 

I recommend adding 

 

if (getClient().getLoginState() == LoginState.LOADING || getClient().getLoginState() == LoginState.LOADING_MAP) {
return 300;
}

To your loop smile.png

Thank you sir I'll give it a go!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...