Jump to content

Counting while webwalk


Recommended Posts

Posted

Hello, i'm tryng to make a counter while webwalk but it never works. I guess no other process is running until the webwalk is finished.

 

Can anyone tell me how can i make a counter while walking?

 

Here's the code example:

 

int count = 0;

int counterRandom = random(1,15);

@Override
public int onLoop() throws InterruptedException {

if (myPlayer().isMoving()) {

    count += 1;
    sleep(1000);
    log(count);
}

if (count == counterRandom) {

    log("Done");
    counterRandom = random(1,15);
    count = 0;
}

return 0;
}
 
Posted
3 hours ago, Yusi said:

Hello, i'm tryng to make a counter while webwalk but it never works. I guess no other process is running until the webwalk is finished.

 

Can anyone tell me how can i make a counter while walking?

 

Here's the code example:

 

int count = 0;

int counterRandom = random(1,15);

@Override
public int onLoop() throws InterruptedException {

if (myPlayer().isMoving()) {

    count += 1;
    sleep(1000);
    log(count);
}

if (count == counterRandom) {

    log("Done");
    counterRandom = random(1,15);
    count = 0;
}

return 0;
}
 
int count = 0;
int counterRandom = random(1, 15);
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

@Override
public int onLoop() throws InterruptedException {
    if (myPlayer().isMoving()) {
        count += 1;
        sleep(1000);
        log(count);
    }

    if (count == counterRandom) {
        log("Done");
        counterRandom = random(1, 15);
        count = 0;
    }

    return 0;
}

// separate thread
public void startCounter() {
    executor.scheduleAtFixedRate(new Runnable() {
        public void run() {
            if (!myPlayer().isMoving()) {
                count = 0;
            }
        }
    }, 0, 1, TimeUnit.SECONDS);
}

// stop counter
public void stopCounter() {
    executor.shutdown();
}

// call start counter method before starting webwalking
startCounter();

// perform webwalk

// call stop counter method after webwalking is finished
stopCounter();

So basically, what you need to do is start a counter before you begin the webwalk. This counter will run in the background while you're moving. It will keep track of the count every second. If your player stops moving, the counter will reset back to zero.

  • Heart 1
Posted
3 hours ago, Zackaery said:
int count = 0;
int counterRandom = random(1, 15);
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);

@Override
public int onLoop() throws InterruptedException {
    if (myPlayer().isMoving()) {
        count += 1;
        sleep(1000);
        log(count);
    }

    if (count == counterRandom) {
        log("Done");
        counterRandom = random(1, 15);
        count = 0;
    }

    return 0;
}

// separate thread
public void startCounter() {
    executor.scheduleAtFixedRate(new Runnable() {
        public void run() {
            if (!myPlayer().isMoving()) {
                count = 0;
            }
        }
    }, 0, 1, TimeUnit.SECONDS);
}

// stop counter
public void stopCounter() {
    executor.shutdown();
}

// call start counter method before starting webwalking
startCounter();

// perform webwalk

// call stop counter method after webwalking is finished
stopCounter();

So basically, what you need to do is start a counter before you begin the webwalk. This counter will run in the background while you're moving. It will keep track of the count every second. If your player stops moving, the counter will reset back to zero.

Thank you ill try it out

Posted (edited)
3 hours ago, Yusi said:
 
 
random events especially for walking like customized camera movements or missclicks

ah, you mean randomized actions. You can do those in a timer and execute them regardless if it's walking or not. It doesm't do anything to reduce bans just so you know.

Create various timers for the actions and couple the action with the timer reset. Run these on separate threads.

Edited by FushigiBot
  • Heart 1
Posted

Declare a timestamp variable before you execute the web walk. This will record the current time when you start the web walk.

Then in the web walking conditional event do a comparison between your timestamp and the current timestamp. ORIGINAL_TIMESTAMP - CURRENT_TIMESTAMP = TOTAL ELAPSED TIME IN MILLISECONDS.

In the conditional event if the total elapsed time equals whatever value you want, then exit the web walking event and using the same logic you can create a statement (or method) to compare the timestamps again before executing the web walk. If the timestamps equal the amount of time you want elapsed, then execute your code. Otherwise continue walking.

To improve the functionality you can use a class in its entirety to handle all of this. You could use a singleton design pattern for a class called "RANDOMIZER" and handle all of the code in this special class.

  • Heart 1

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