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.

Better fighting method?

Featured Replies

Hi, I am using the following as my fighting part of my script: 

Was wondering if there were any additions people would make to improve this?

if (!getCombat().isFighting()) { //not in combat
    if (warrior != null) { //if it exists
        if (warrior.interact("Attack")) { //attack
            new ConditionalSleep(3000, 600) { //sleep for 3 seconds or until the condition is true
                @Override
                public boolean condition() throws InterruptedException {
                    return getCombat().isFighting();
                }
            }.sleep();
        }
    }
}

no idea what im looking at fam all i see is sleep which is what im bout to do

  • Author
3 minutes ago, Apaec said:

Looks good - If it runs well then there's no problem!

Thanks, yeah it does run well, was just wondering if there were any extra bits i could add but thanks for fb

  • Author
11 minutes ago, El_Maestro said:

This is a great start. As APA said, if it works there is no problems! If you want to decrease the delay between individual npc interactions make your own isFighting() method that takes an npc as a parameter.

Would this help you think or the inbuilt one good enough?

Also you could always take advantage of the return value of the conditional sleep to determine what to do if the interaction for whatever reason fails (misclick, ...)

e.g:

if (!getCombat().isFighting()) { //not in combat
    if (warrior != null) { //if it exists
        if (warrior.interact("Attack") && new ConditionalSleep(3000, 600) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getCombat().isFighting();
                }
            }.sleep()) { log("Success!");
        } else log("Fail :(");
    }
}

 

  • Author
1 hour ago, Apaec said:

Also you could always take advantage of the return value of the conditional sleep to determine what to do if the interaction for whatever reason fails (misclick, ...)

e.g:


if (!getCombat().isFighting()) { //not in combat
    if (warrior != null) { //if it exists
        if (warrior.interact("Attack") && new ConditionalSleep(3000, 600) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getCombat().isFighting();
                }
            }.sleep()) { log("Success!");
        } else log("Fail :(");
    }
}

 

ah fair enough :)

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.