Zgxgou 1 Posted October 1, 2023 Short and sweet - when trying to use lambda expressions (i.e. "()->...") there is an indirect reference to org.3b which is not getting recognized so I can't use this syntax... Error message: "The type org.3b cannot be resolved. It is indirectly referenced from required type org.dreambot.api.input.MouseJava(16777563)" I tried adding screenshots but got -200 error... Any advice is greatly appreciated. Regards, Zg
Zgxgou 1 Author Posted October 1, 2023 Thanks for the quick reply. Here's 2 examples from the tutorial woodcutting script. My IDE (VSCode) isn't liking the org.2/3 imports which are in the underlying classes. If I remove the lambda expressions, the code is happy. Note, I tried from a different PC and seeing slightly different results (org.2x now vs org.2b before). Example 1 - closest(()->...) GameObject bankBooth = GameObjects.closest(b -> b != null && b.getName().equalsIgnoreCase("Bank booth")); Error message: The type org.2x cannot be resolved. It is indirectly referenced from required type org.dreambot.api.methods.container.impl.InventoryJava(16777563) Example 2 - sleepUntil(()->...) case BANKING: Bank.depositAll("Logs"); Sleep.sleepUntil(() -> !Inventory.contains("Logs"), 2000); if (!Inventory.contains("Logs")) { Bank.close(); } break; Error message: The type org.2x cannot be resolved. It is indirectly referenced from required type org.dreambot.api.methods.container.impl.InventoryJava(16777563) Thanks, Zg
Pandemic 2823 Posted October 1, 2023 You may need to clean your project or re-add the client as the library. Is that an IDE warning, or an actual compile error? Do you have the full logs from that?
Zgxgou 1 Author Posted October 1, 2023 @Pandemic A compile error. I tried refreshing client.jar, clean workspace, and rebuild. Perhaps I'll try intellij IDE for reference. I'm not seeing any logs, just a red squiggle and the error message I posted. No "quick fixes..." this time... Let me know if you have any other suggestions. Thanks, Zg
sloppybot 18 Posted October 2, 2023 (edited) For banking try fetching the object first, then check if it is null. GameObject bankBooth = GameObjects.closest("Bank booth"); // Get's nearest Bank booth GameObject if (bankBooth!= null && bankBooth.interact("Bank")) // If it's not null, and interact "Bank" on the object successFul. Sleep.sleepUntil(bankBooth::isOpen, 4000); // Sleep until bank booth is open or 4000 ms passed. For the second one make sure you have imported the correct "Bank"; see my first line in the code below. You should also check if bank was opened before trying to deposit. I took the time to write some more code to deposit all items in the inventory except for an axe if the user is carrying one. import org.dreambot.api.methods.container.impl.bank.Bank; // <- This must be imported case BANKING: if (Bank.isOpen()) { // Check if bank is Open if (Inventory.contains(item -> item.getName().contains("axe")) // If user has an Axe in inventory Bank.depositAllExcept(item -> item.getName().contains("axe")); // Deposit everything except axe else // If no axe in bag(Is equipped) Bank.depositAllItems(); // Deposit all items, includes birds nest, logs, random junk the bot clicked on by mistake etc. Sleep.sleepUntil(() -> Inventory.onlyContains(item -> item.getName().contains("axe")) || Inventory.isEmpty(), 10000); if (Inventory.onlyContains(item -> item.getName().contains("axe")) || Inventory.isEmpty()) { // Check if our condition is met. Bank.close(); // Then close the bank } break; Edited October 2, 2023 by sloppybot
Zgxgou 1 Author Posted October 11, 2023 Hi @sloppybot, thanks for your reply Here is what I see when I use your first code snippet https://ibb.co/YczwBsk Here is what I see when I use your second code snippet https://ibb.co/B3t2DD1 If the links don't work, here's the gist: "The type org.3b cannot be resolved. It is indirectly referenced from required type org.dreambot.api.input.MouseJava(16777563)" Here is what I see when looking in the Mouse class https://ibb.co/JdbSNZt Perhaps I need to use Intellij, I'm just a bit surprised all other methods appear to be working. My scripts are running fine but having issues with sleepUntil(()->...) and closest(x->...) is definitely lowering the quality of my code. Thanks again, Zg
sloppybot 18 Posted October 11, 2023 2 hours ago, Zgxgou said: Hi @sloppybot, thanks for your reply Here is what I see when I use your first code snippet https://ibb.co/YczwBsk Here is what I see when I use your second code snippet https://ibb.co/B3t2DD1 If the links don't work, here's the gist: "The type org.3b cannot be resolved. It is indirectly referenced from required type org.dreambot.api.input.MouseJava(16777563)" Here is what I see when looking in the Mouse class https://ibb.co/JdbSNZt Perhaps I need to use Intellij, I'm just a bit surprised all other methods appear to be working. My scripts are running fine but having issues with sleepUntil(()->...) and closest(x->...) is definitely lowering the quality of my code. Thanks again, Zg If the Dreambot artifact is properly imported you should try cleaning your project cache. Eclipse -> project settings -> clean project Zgxgou 1
Zgxgou 1 Author Posted October 11, 2023 @sloppybot Well - I installed Intellij and the issue is resolved... The org.2w imports are still highlighted, but no issues like in VSCode. Guess I'm switching to IntelliJ Thanks everyone for your inputs on this. Regards, Zg sloppybot 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now