WhatIfand Posted January 1, 2019 Share Posted January 1, 2019 (edited) Disclaimer : All pseudo code (Wouldn't mind real code answers ) I'd love some help knowing how to program pre emptive mouse hovering and interaction. I haven't familiarized myself with the API, so I've just been considering the logic of these things. Such as when the bot is running toward an area, and it has already clicked on the intractable object contained within the area it's running to. (and allows the player to run toward the object via interaction running) if (myplayer.distance(areaOfObject) < 6){ object.interact; } or while fighting a monster, hovering the mouse over the next monster to attack. This one i thought you may want to define 2 variables - one is closest npc and other is a 2nd closest npc? Any thoughts on this? if (closestMonster.gethealth(<30)){ getMouse.hover(secondMonster); } The only issue with the above is that the 2nd monster would be changing constantly (due to distance '.closest') unless theres a way to make a variable static based upon monster 1. Like whoever is 2nd closest at that moment is assigned as a new variable (nextTarget). Would also have to check their distance and status to ensure the bot doesnt attack something which is being attack by another player AFTER the assignment to the nextTarget variable. -quite complex, i may be overthinking it. My initial reasoning for implementing these features was antiban, but upon enlightenment of its uselessness I think this functionality techniques would make things happen faster. Which would be very useful with a large scale gold farm. Thanks guys. As i typed 'thanks guys' I questioned : is there a single female on this website as a dev? Not to assume gender roles (lol) but lets be honest this is a pretty male nerd place to be. Edited January 1, 2019 by WhatIfand punctuation Quote Link to comment Share on other sites More sharing options...
NoxMerc Posted January 1, 2019 Share Posted January 1, 2019 For breaking early based on distance, you'll want to use a WalkingEvent (or WebWalkingEvent) and set a break condition for the event. It could be something as simple as Supplier<NPC> npcFinder = () -> getNpcs().closest(f -> f.getName().equals("NpcToFind") && f.getPosition() != null && f.getPosition().distance(myPosition()) <= 7 && getMap().canReach(f)); Condition breakCondition = new Condition() { @Override public boolean evaluate() { return npcFinder.get() != null; } }; new WalkingEvent(myPos).setBreakCondition(breakCondition).execute(); NPC targetNpc = npcFinder.get(); if (targetNpc != null) if (targetNpc.interact()) //Do stuff This will break out of your walking event as soon as the NPC is able to be reached, and interact with it. You'll use a similar concept for hovering the next monster to attack. In the execution of your combat-block, determine if the NPC you're fighting is about to die, and if so, find the next target and hover over it. You'll need to constantly validate that it's a valid target and isn't in combat with another player. 2 Quote Link to comment Share on other sites More sharing options...
WhatIfand Posted January 2, 2019 Author Share Posted January 2, 2019 19 hours ago, NoxMerc said: For breaking early based on distance, you'll want to use a WalkingEvent (or WebWalkingEvent) and set a break condition for the event. It could be something as simple as Supplier<NPC> npcFinder = () -> getNpcs().closest(f -> f.getName().equals("NpcToFind") && f.getPosition() != null && f.getPosition().distance(myPosition()) <= 7 && getMap().canReach(f)); Condition breakCondition = new Condition() { @Override public boolean evaluate() { return npcFinder.get() != null; } }; new WalkingEvent(myPos).setBreakCondition(breakCondition).execute(); NPC targetNpc = npcFinder.get(); if (targetNpc != null) if (targetNpc.interact()) //Do stuff This will break out of your walking event as soon as the NPC is able to be reached, and interact with it. You'll use a similar concept for hovering the next monster to attack. In the execution of your combat-block, determine if the NPC you're fighting is about to die, and if so, find the next target and hover over it. You'll need to constantly validate that it's a valid target and isn't in combat with another player. Simple enough. Appreciate the response man. Quote Link to comment Share on other sites More sharing options...