Neks 0 Posted March 15, 2023 Hey, I'm currently working on my own little essence rune miner. Sadly i'm struggling about the portal usage. Most of the time GamoObjects.closest will not detect the Portal. I tried debugging with .all(item -> item.getName().equal(Portal)) But the portal does not exists. If i'm walking manual and restart the script the detection works as well. My idea is to store all 4 Tiles and calculate the minimal distance to improve my object range. But ... it sounds really nasty. If anyone know a better way i will be happy to hear. Thanks. Edit: This is my current implementation of leaving runeessence. Portal canot be found randomly. If the script are not able to find the portal i'm also not able to find the portal on GameObjects.all(). Could it be a bug? package DBMiner; import org.dreambot.api.methods.Calculations; import org.dreambot.api.methods.container.impl.Inventory; import org.dreambot.api.methods.dialogues.Dialogues; import org.dreambot.api.methods.interactive.GameObjects; import org.dreambot.api.script.TaskNode; import org.dreambot.api.wrappers.interactive.GameObject; import javax.swing.text.html.parser.Entity; public class LeaveEssenceMine extends TaskNode { @Override public int priority() { return 4; } @Override public boolean accept() { return Inventory.isFull() && GameObjects.closest("Rune Essence") != null; } @Override public int execute() { if(Dialogues.canContinue()){ Dialogues.continueDialogue(); } GameObject portal = GameObjects.closest(item -> item.getName().equals("Portal")); if(portal == null) { portal =GameObjects.closest(item -> item.hasAction("Use")); } if(portal != null) { String[] action = portal.getActions(); portal.interact(); } return Calculations.random(3000); } }
Neks 0 Author Posted March 15, 2023 I have now run the script longer and noticed that the error occurs sporadically in different instances of Rune Mine. GameObjects just doesn't seem to contain the elements.
xyz111 90 Posted March 15, 2023 2 hours ago, Neks said: I have now run the script longer and noticed that the error occurs sporadically in different instances of Rune Mine. GameObjects just doesn't seem to contain the elements. That's right. These portals can be found as NPC when not a GameObject
Neks 0 Author Posted March 18, 2023 Alright. Thank you very much! Edit: Tested your solution. Works as expected 👌
Recommended Posts
Archived
This topic is now archived and is closed to further replies.