Jump to content

Counting while webwalk


Yusi

Recommended Posts

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

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

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

Link to comment
Share on other sites

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

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