April 24, 20169 yr 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. 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 April 24, 20169 yr by lg_juggles
April 24, 20169 yr 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. Edited April 24, 20169 yr by DragonAlpha
April 24, 20169 yr Author 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 April 24, 20169 yr by lg_juggles
April 24, 20169 yr If you are constantly hopping and the condition is being check while you are logged out, wouldn't that be the problem? I assume you are hopping since you are shop buying.
April 24, 20169 yr 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: Coins under 1000 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 Edited April 24, 20169 yr by DragonAlpha
April 24, 20169 yr Author If you are constantly hopping and the condition is being check while you are logged out, wouldn't that be the problem? I assume you are hopping since you are shop buying. I thought it wouldn't check the condition if it was logged out? That may be the problem then.
April 24, 20169 yr 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; }
April 24, 20169 yr I thought it wouldn't check the condition if it was logged out? That may be the problem then. Not sure. Just a thought.
April 24, 20169 yr 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 April 24, 20169 yr by Final
May 9, 20169 yr 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