Jump to content

Glitch in Client?


Juggles

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

I thought it wouldn't check the condition if it was logged out? That may be the problem then.

 

 

Try adding this at the top of your onLoop(). Let us know if the problem still happens.

if(client.getLoginState() == Client.LoginState.LOGGED_OUT) {
   log("Waiting for login");
   return; // return 250;
}
Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • 2 weeks later...

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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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