Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Counting while webwalk

Featured Replies

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

  • Author
4 hours ago, Gunman said:

Wtf why????

For random events while walking

You don't have to count for that. Just write a separate thread where you check for random events and sleep every 5 secs or so.

  • Author
10 minutes ago, FushigiBot said:

You don't have to count for that. Just write a separate thread where you check for random events and sleep every 5 secs or so.

 
 
random events especially for walking like customized camera movements or missclicks
  • Author
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

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

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.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.