Jump to content

Help: Walk from any location to a predefined mob area


Hussain1e

Recommended Posts

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...");
    }
}

 

Link to comment
Share on other sites

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....

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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