Jump to content

Easy help


Recommended Posts

Posted (edited)

I am trying to get my player to walk back to ONE specific coord(x, y, z), I am using getWalking().walk(coord) and the bot always seems to click one tile off of the coordinate I have it set to move to.

 

I need to be on a specific tile to aggro all the monsters and efficiently run my script

 

Also on tips/ideas/logic about having myPlayer reset aggro?

I'm using a not so good check because If I kill all the crabs my script thinks I have to reset aggro

		if (!myPlayer().isHitBarVisible()) {
				if (!RESET_AREA.contains(myPlayer())) {

					return State.Reset;
				}
		}
		

Is there a efficient way to set a timer so after a certain amount of time the script returns a state?

 

By the way, trying to make a simple Sandcrab killer with resetting

Thank you so much !

Edited by domp
Posted

I am trying to get my player to walk back to ONE specific coord(x, y, z), I am using getWalking().walk(coord) and the bot always seems to click one tile off of the coordinate I have it set to move to.

 

I need to be on a specific tile to aggro all the monsters and efficiently run my script

 

Also on tips/ideas/logic about having myPlayer reset aggro?

I'm using a not so good check because If I kill all the crabs my script thinks I have to reset aggro

		if (!myPlayer().isHitBarVisible()) {
				if (!RESET_AREA.contains(myPlayer())) {

					return State.Reset;
				}
		}
		

Is there a efficient way to set a timer so after a certain amount of time the script returns a state?

 

By the way, trying to make a simple Sandcrab killer with resetting

Thank you so much !

 

Use the WalkingEvent:

WalkingEvent walkingEvent = new WalkingEvent(position);
walkingEvent.setMinDistanceThreshold(0);
execute(walkingEvent);
  • Like 2
Posted

 

Use the WalkingEvent:

WalkingEvent walkingEvent = new WalkingEvent(position);
walkingEvent.setMinDistanceThreshold(0);
execute(walkingEvent);

Thankyou, I implemented this and I will let you know how it works, currently laying low..did alot of testing that was faulty

 

 

For a timer you could do something like this:

//Class variable
private long timer;

//when you want to start/reset the timer
timer = System.currentTimeMillis();

//to check if the timer is past a certain amount of time, ex. 1 min.
System.currentTimeMillis() - timer >= 60000;

Thank you for this idea! I will be using this for my reset state!

Posted


public class Timer {

private final long start;

private final long period;

private long end;

public Timer(long period) {

this.period = period;

this.start = System.currentTimeMillis();

this.end = (this.start + period);

}

public long getElapsed()

{

return System.currentTimeMillis() - this.start;

}

public long getRemaining() {

if (isRunning()) {

return this.end - System.currentTimeMillis();

}

return 0L;

}

public boolean isRunning()

{

return System.currentTimeMillis() < this.end;

}

public void reset()

{

this.end = (System.currentTimeMillis() + this.period);

}

public long setEndIn(long ms) {

this.end = (System.currentTimeMillis() + ms);

return this.end;

}

public String toElapsedString()

{

return Time.format(getElapsed());

}

public String toRemainingString()

{

return Time.format(getRemaining());

}

}


public class Time {

public static String format(long time) {

StringBuilder t = new StringBuilder();

long total_secs = time / 1000L;

long total_mins = total_secs / 60L;

long total_hrs = total_mins / 60L;

long total_days = total_hrs / 24L;

int secs = (int)total_secs % 60;

int mins = (int)total_mins % 60;

int hrs = (int)total_hrs % 24;

int days = (int)total_days;

if (days > 0) {

if (days < 10) {

t.append("0");

}

t.append(days);

t.append(":");

}

if (hrs < 10) {

t.append("0");

}

t.append(hrs);

t.append(":");

if (mins < 10) {

t.append("0");

}

t.append(mins);

t.append(":");

if (secs < 10) {

t.append("0");

}

t.append(secs);

return t.toString();

}

}

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