October 26, 20196 yr 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?
October 26, 20196 yr It's probably not related to the code if creating a new project with the same code makes it work
October 26, 20196 yr Author 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?
October 26, 20196 yr Just now, Phree said: Then what makes it go wrong? I guess wrong project setup, not building the script jar properly, many other things
October 26, 20196 yr Author When I put this on the top of my OnLoop out of the function and before executing any other code it still logs 2.
October 26, 20196 yr 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, 20196 yr by BravoTaco
October 26, 20196 yr Author 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.
October 26, 20196 yr 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, 20196 yr by BravoTaco
October 26, 20196 yr Author Thanks all. Very strange but I just got back and run the script and now everything works as before. Spooky.
Create an account or sign in to comment