k9thebeast Posted October 27, 2016 Share Posted October 27, 2016 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; } Quote Link to comment Share on other sites More sharing options...
Explv Posted October 27, 2016 Share Posted October 27, 2016 (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 October 27, 2016 by Explv Quote Link to comment Share on other sites More sharing options...
k9thebeast Posted October 27, 2016 Author Share Posted October 27, 2016 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! Quote Link to comment Share on other sites More sharing options...
Explv Posted October 27, 2016 Share Posted October 27, 2016 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! I meant where in your code are you calling your getState() method Quote Link to comment Share on other sites More sharing options...
k9thebeast Posted October 27, 2016 Author Share Posted October 27, 2016 (edited) Ah sorry. Here is my loop() @[member='Override'] public int onLoop() throws InterruptedException { switch (getState()) { case A: log("State A"); break; case B: log("State B"); break; case C: log("State C"); break; } return random(200,500); } Edited October 27, 2016 by k9thebeast Quote Link to comment Share on other sites More sharing options...
Explv Posted October 27, 2016 Share Posted October 27, 2016 Ah sorry. Here is my loop() @[member='Override']public int onLoop() throws InterruptedException { switch (getState()) { case A: log("State A"); break; case B: log("State B"); break; case C: log("State C"); break; } return random(200,500);} Ok looks fine as far as I can see Quote Link to comment Share on other sites More sharing options...
House Posted October 27, 2016 Share Posted October 27, 2016 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 Quote Link to comment Share on other sites More sharing options...
k9thebeast Posted October 27, 2016 Author Share Posted October 27, 2016 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 Thank you sir I'll give it a go! Quote Link to comment Share on other sites More sharing options...