Jump to content

Glitch in Client?


Recommended Posts

Posted (edited)

My script tells it to log out when it is below 1000 coins. My inventory has well over 1000 coins but the Debugger is saying I have no coins in my inventory.
 

 

 

 

301j1tu.png

 

Here is my code: 

if (getInventory().getAmount("Coins") <= 1000) {

log("Apparently I've got less than 1000 coins?");
log(("Amount of coins: ") + getInventory().getAmount("Coins"));
stop();
}

 

 

Edited by lg_juggles
  • Like 1
Posted (edited)

Why are you getting an NPE in Store?

 

The NPE isn't the problem though. The client is not recognizing that I have coins in the inventory. I was able to bypass this by using

 

if (getInventory().getAmount("Coins") <= 1000 && getInventory().getAmount("Coins") > 1) {

log("Apparently I've got less than 1000 coins?");

log(("Amount of coins: ") + getInventory().getAmount("Coins"));

stop();

}

 

so that means the client is not recognizing it sometimes 

Edited by lg_juggles
Posted (edited)

The NPE is the problem though. The client is recognizing that I have coins in the inventory. I was able to bypass this by using

 

if (getInventory().getAmount("Coins") <= 1000 && getInventory().getAmount("Coins") > 1) {

log("Apparently I've got less than 1000 coins?");

log(("Amount of coins: ") + getInventory().getAmount("Coins"));

stop();

}

 

so that means the client is recognizing it sometimes 

 

Interesting.

 

So the client sometimes tells us there are 0 coins in the inventory, I am unsure why at this point. So you are avoiding this by adding an extra check:

  1. Coins under 1000
  2. Coins greater than 1

Because this solution works, that does possibly hint towards something in the client. I would dismiss this as scripter error, but, it happens with me too sad.png

Edited by DragonAlpha
Posted (edited)

TFW is correct, the client handles data in a very obscure way keeping some data loaded when logged out.

You should always check your login state to be 30 before peforming an action otherwise this will create increasingly annoying issues.

Ultimately youll want to make sure there is an item called coins in your inventory (the item is not null ) and use this instance to invoke the method, as well as if you are in game before attempting any in game interactions.

Edited by Final
  • Like 1
  • 2 weeks later...
Posted

Might be because OSBot *sometimes* thinks "Coins" does not exist? This may then explain why getAmount() returns 0, and gives a NPE.

 

I get this error sometimes, sometimes my scripts would stop "Out of coins", it happened rarely though.

thats since the inventory hasn't loaded yet. be sure to open the inventory if its not already before checking. errors like these will happen right when you log in

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...