Jump to content

Easy help


domp

Recommended Posts

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

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

 

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!

Link to comment
Share on other sites


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();

}

}

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