Jump to content

Walk path not applicable argument?


m3nbersures

Recommended Posts

Hello i want make my bot walk with a position path like this bug.PNG.359cb416782a4d6a5b804d28953a79d9.PNG

I have this error. 

did i need to read through a for loop?

for (int i = 0, i < HILLS_PATH.length() , i++ {

getWalking.walk(HILLS_PATH[ i ]);

}

thx for the help

 

ps: normally i make the position path as a constant with a final

Edited by m3nbersures
Link to comment
Share on other sites

1 hour ago, 01053 said:

private List<Position> path = Arrays.asList(new Position(x,y,z), new Position(x,y,z));
  
script.getWalking().walkPath(path);

I believe something like this is what you are after?

yes thank you very much

1 minute ago, superuser said:

0kqbx2R.png

you need a LinkedList for walking events.

3FvsNjg.png

I included a break condition as well for better efficiency and responsiveness.
Happy scripting!

wow i like the effort you make for that very apreciated  ++ rep

Edited by m3nbersures
  • Like 2
Link to comment
Share on other sites

2 hours ago, m3nbersures said:

yes thank you very much

wow i like the effort you make for that very apreciated  ++ rep

Also make sure you populate the LinkedList when the script starts in the onStart() method.

So you're not having to spend time repopulating the List everytime you call the HILLS_RUN() method, not a major problem but good practise.

Also another thing I'd probably do is -

Change 

wEvent.setPath(HILLS_PATH);

To

w.setPath(HILLS_PATH).setMinDistanceThreshold(2).setMiniMapDistanceThreshold(2);

So you aren't literally walking to the exact same tile every time.

Edited by 01053
Link to comment
Share on other sites

6 hours ago, 01053 said:

Also make sure you populate the LinkedList when the script starts in the onStart() method.

So you're not having to spend time repopulating the List everytime you call the HILLS_RUN() method, not a major problem but good practise.

Also another thing I'd probably do is -

Change 


wEvent.setPath(HILLS_PATH);

To


w.setPath(HILLS_PATH).setMinDistanceThreshold(2).setMiniMapDistanceThreshold(2);

So you aren't literally walking to the exact same tile every time.


The default min distance threshold is 3, and the default mini map distance threshold is 5 so I don't think he really needs to change those values.

Also mini map distance threshold does not affect whether the player walks to the same position or not:

"This method sets the property of this walking event that determines whether the next position you're walking to in the path from A to B will be walked to by using the mini map or the main screen. The next location you're walking to is not necessarily the destination of this event, but the next clickable position in the path from A to B. If the distance to the next clickable position is equal or higher than the mini map distance threshold, this event will walk using the mini map. If not, it will use the main screen. The default value of this property is 5."

 

 

8 hours ago, superuser said:

0kqbx2R.png

you need a LinkedList for walking events.

3FvsNjg.png

I included a break condition as well for better efficiency and responsiveness.
Happy scripting!


This is correct, can be simplified a little though (and you shouldn't create the LinkedList every time you want to walk)

public static final Area HILLS_AREA = new Area(1, 2, 3, 4);

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);

public final void someMethod() {
    WalkingEvent walkingEvent = new WalkingEvent();
    walkingEvent.setPath(HILLS_PATH);
    walkingEvent.setBreakCondition(new Condition() {
        return HILLS_AREA.contains(myPosition());
    });
    execute(walkingEvent);
}


If you don't need to use setBreakCondition or any of the other functions though, then this will do:
 

private static final List<Position> HILLS_PATH = Arrays.asList(new Position(1, 2, 0), new Position(2, 3, 0));

public final void someMethod() {
    getWalking().walkPath(HILLS_PATH); 
}



 

Edited by Explv
  • Like 2
Link to comment
Share on other sites

3 hours ago, Explv said:

This is correct, can be simplified a little though (and you shouldn't create the LinkedList every time you want to walk)


public static final Area HILLS_AREA = new Area(1, 2, 3, 4);

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);

public final void someMethod() {
    WalkingEvent walkingEvent = new WalkingEvent();
    walkingEvent.setPath(HILLS_PATH);
    walkingEvent.setBreakCondition(new Condition() {
        return HILLS_AREA.contains(myPosition());
    });
    execute(walkingEvent);
}


If you don't need to use setBreakCondition or any of the other functions though, then this will do:
 


private static final List<Position> HILLS_PATH = Arrays.asList(new Position(1, 2, 0), new Position(2, 3, 0));

public final void someMethod() {
    getWalking().walkPath(HILLS_PATH); 
}



 

yeah i know i wrote it like that because i was just expanding on what he had. in hindsight i should have just wrote it the proper way so he doesn't develop bad habits.

this is how i actually do things normally

N5xU2Ky.png
69ij727.png

 

Edited by superuser
deleted duplicate image
  • Like 1
Link to comment
Share on other sites

2 hours ago, superuser said:

yeah i know i wrote it like that because i was just expanding on what he had. in hindsight i should have just wrote it the proper way so he doesn't develop bad habits.

this is how i actually do things normally

N5xU2Ky.png
69ij727.png

 


Yeah fair enough, you don't need those for loops though, you can create a LinkedList<Position> like so:

public static final LinkedList<Position> HILLS_PATH = new LinkedList<>(
        Arrays.asList(
                new Position(1, 2, 0),
                new Position(2, 3, 0)
        )
);
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...