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

If Player is in Combat, Wait

Featured Replies

I know what I'm doing wrong but I don't know the solution. player.isInCombat doesn't work.
 
Could I do: 

else(player.isInCombat()) {
Wait until player is out of combat
}

I'm not familiar with the API and I'm not really sure how I go about finding the bits and pieces I need for my script. The API website page is really confusing and hard to find exactly what I "think" I'm looking for.

    @Override
    public int onLoop() {


     NPC manWoman = npcs.closest("Man", "Woman");
     
     if(manWoman != null){
     manWoman.interact("Attack");
     }
     


        return 100;
    }

Just do

if(manWoman!=null&&!myPlayer().isUnderAttack)
blahblahblah;

this will make it so it won't search for another man unless you're out of combat

Edited by twin 763

 

I will try that...This is what I came up with:

 

     if(players.getCombat() != null)
     Thread.sleep(1500, 2000);
        return 100;

 

I would just use !myPlayer().isUnderAttack, because that will kind of sleep it from interacting with men until its out of combat.

  • Author

Thank you, it works, I'm going to change Return to 1500msec because it's spam clicking them. Also, they're inside a building, sometimes outside, I need something like:

 

If(manWoman.isUnreachable && doorObject.isClosed)

open door;

 

If you know any good tutorials for complete beginners, I will definitely read them. I feel bad for basically asking you to make this script for me.

Edited by jeremy4444

Thank you, it works, I'm going to change Return to 1500msec because it's spam clicking them. Also, they're inside a building, sometimes outside, I need something like:

If(manWoman.isUnreachable && doorObject.isClosed)

open door;

If you know any good tutorials for complete beginners, I will definitely read them. I feel bad for basically asking you to make this script for me.

Did you use the ! In front of myPlayer? ! Means not or the opposite of what you're saying. If(!inventory.isFull()) means if inventory is not full.

And you can just have the bot open the door every time it's closed to make things easier.

If(door.contains("Open")

door.interact("Open");

If you want to get more advanced you can override messageListener, and say whenever "I can't reach this" shows up in chat, open the door. Then you can also do a minimap check

Which I'm not to sure how to do, because I've never used it. Or you can just set an area that doesn't contain what's outside of the door and say like

If(!MANWOMANAREA.contains(manWoman))

manWoman.interact("Attack");

Edited by twin 763

if (map.canReach(manWoman)) {

Will test if you can reach the man, finding the door in the way is a bit harder. You can use a method similar to what Twin suggested for a simple fix, but it could pick the wrong door potentially.

Edited by dudeami

if (map.canReach(manWoman)) {
Will test if you can reach the man, finding the door in the way is a bit harder. You can use a method similar to what Twin suggested for a simple fix, but it could pick the wrong door potentially.
This was the minimap way I was talking about. Couldnt remember it off the top of my head.

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

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.