Phree Posted October 26, 2019 Share Posted October 26, 2019 Hello, For some reason this keeps logging 2 while I'm 100% sure I got a Wooden shield in my inventory... Quote public boolean woodenShieldInBotInv() { if (phreeBot.getInventory().contains("Wooden shield")) { phreeBot.log("1"); return true; } else { phreeBot.log("2"); } return false; } What am I doing wrong? When I create a new project with the same code it just works however in my existin project it doesn't when it used to work just right. Before asking what all my other code is, does that matter? Quote Link to comment Share on other sites More sharing options...
Token Posted October 26, 2019 Share Posted October 26, 2019 It's probably not related to the code if creating a new project with the same code makes it work Quote Link to comment Share on other sites More sharing options...
Phree Posted October 26, 2019 Author Share Posted October 26, 2019 2 minutes ago, Token said: It's probably not related to the code if creating a new project with the same code makes it work Then what makes it go wrong? Quote Link to comment Share on other sites More sharing options...
Token Posted October 26, 2019 Share Posted October 26, 2019 Just now, Phree said: Then what makes it go wrong? I guess wrong project setup, not building the script jar properly, many other things Quote Link to comment Share on other sites More sharing options...
Phree Posted October 26, 2019 Author Share Posted October 26, 2019 When I put this on the top of my OnLoop out of the function and before executing any other code it still logs 2. Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted October 26, 2019 Share Posted October 26, 2019 (edited) Try putting the code directly into the OnLoop without using your phreeBot call just do getInventory().contains(name) If that works than it might be how your setting the phreeBot var. Edited October 26, 2019 by BravoTaco Quote Link to comment Share on other sites More sharing options...
Phree Posted October 26, 2019 Author Share Posted October 26, 2019 24 minutes ago, BravoTaco said: Try putting the code directly into the OnLoop without using your phreeBot call just do getInventory().contains(name) If that works than it might be how your setting the phreeBot var. I did this and it still logs 2. Quote Link to comment Share on other sites More sharing options...
BravoTaco Posted October 26, 2019 Share Posted October 26, 2019 (edited) Very interesting. Might be as token said. You could get all the items in the inventory and see if it detects any items at all. getInventory.getItems() - returns item array, i think Loop through that and log the name of the items. Edited October 26, 2019 by BravoTaco Quote Link to comment Share on other sites More sharing options...
Phree Posted October 26, 2019 Author Share Posted October 26, 2019 Thanks all. Very strange but I just got back and run the script and now everything works as before. Spooky. Quote Link to comment Share on other sites More sharing options...