Jump to content

Help: Walk from any location to a predefined mob area


Recommended Posts

Posted

So I decided to do some scripting in my spare time. And as a first step to check some things out, I wanted the bot to walk to a certain position from any location (starting position should be variable and the ending position should be contant). 

So somewhere I read that you could use this piece of code to walk somewhere(lumbridge general store coords):

public Position GeneralStore = new Position(3199, 3245, 0);
getWalking().walk(GeneralStore);

However when running this, nothing really happends (nog even a log that I've made)..

 

"Complete" code:

Spoiler

package Fighter;

//OSBOT API
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.map.Position;


@ScriptManifest(author = "Hussain1e", name = "Fighter", info = "Walk to goblin, kills it, collects loot, walks to bank, bank all and loop", version = 1.0, logo = "")

public final class Fighter extends Script {
    //Goblin location
    public Position GeneralStore = new Position(3199, 3245, 0);

    @Override
    public final void onStart() {
        log("Walking to goblin area...");
        getWalking().walk(GeneralStore);
    }

    @Override
    public final int onLoop() {
        return random(111, 211);
    }

    @Override
    public final void onExit() {
        mouse.moveOutsideScreen();
        log("Closing Script...");
    }
}

 

Posted
15 hours ago, BravoTaco said:

I think the import is:

org.osbot.rs07.api.Walking

Should be the same import as the standard walker uses.

Thank you, I've already got some semi-ideas in work. However I cannot help but think that the way webWalk is walking, is quite "botlike". Is there a way to customize his walking behaviour. For example not only using the mini-map to click but also using the normal surroundings to click for walking. Or increase the intesity of clicking (maybe that he'll sometimes spamclick). Or make it so that he does unnecessary mouse movements while walking and clicking....

Posted
8 hours ago, Hussain1e said:

Thank you, I've already got some semi-ideas in work. However I cannot help but think that the way webWalk is walking, is quite "botlike". Is there a way to customize his walking behaviour. For example not only using the mini-map to click but also using the normal surroundings to click for walking. Or increase the intesity of clicking (maybe that he'll sometimes spamclick). Or make it so that he does unnecessary mouse movements while walking and clicking....

To customize it you will have to use a WebWalkEvent and a PathPreferenceProfile. I don't think you can change how it clicks. There is few different options to be used so you will have to reference the API to see them all, but here is a quick example.

WebWalkEvent webWalkEvent = new WebWalkEvent(location);
//This will ignore using roads and take a more direct path to the destination.
webWalkEvent.useSimplePath();
PathPreferenceProfile pathPreferenceProfile = new PathPreferenceProfile();
pathPreferenceProfile.setAllowSpiritTrees(false);
pathPreferenceProfile.setAllowGliders(false);
webWalkEvent.setPathPreferenceProfile(pathPreferenceProfile);
execute(webWalkEvent);
  • Like 1
Posted
On 10/13/2019 at 10:20 PM, BravoTaco said:

To customize it you will have to use a WebWalkEvent and a PathPreferenceProfile. I don't think you can change how it clicks. There is few different options to be used so you will have to reference the API to see them all, but here is a quick example.


WebWalkEvent webWalkEvent = new WebWalkEvent(location);
//This will ignore using roads and take a more direct path to the destination.
webWalkEvent.useSimplePath();
PathPreferenceProfile pathPreferenceProfile = new PathPreferenceProfile();
pathPreferenceProfile.setAllowSpiritTrees(false);
pathPreferenceProfile.setAllowGliders(false);
webWalkEvent.setPathPreferenceProfile(pathPreferenceProfile);
execute(webWalkEvent);

Wow, thank you so much!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...