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.

initiating combat

Featured Replies

I tried the interaction(attack) way but didn't work. Not too sure the correct usage is for this. If someone can give me the usage or API link so I can actually figure it out for NPC specified.

  • Author
2 minutes ago, Chris said:

npc.interact("Attack"); ?

I said the interactions didn't work. I made over 14 scripts but never really combat related so I dont know what's going on or what to specificly conclude in writing a combat script for this situation.

1 minute ago, Booleans YAY said:

I said the interactions didn't work. I made over 14 scripts but never really combat related so I dont know what's going on or what to specificly conclude in writing a combat script for this situation.

it should work?

unless ur doing something wrong

Npc cow = getNpcs().closest("Cow"):

if (cow != null) cow.interact("Attack");

  • Author
1 hour ago, Chris said:

it should work?

unless ur doing something wrong

Npc cow = getNpcs().closest("Cow"):

if (cow != null) cow.interact("Attack");

            NPC chicken = getNpcs().closest(2820);
            if (chicken != null && chicken.isAttackable()) {
                chicken.interact("Attack");
            }

the chicken id is same relevancy use as the name itself, I tried both name and ID.

also everything you see there was tried with and without pieces being shown.

8 hours ago, Booleans YAY said:

            NPC chicken = getNpcs().closest(2820);
            if (chicken != null && chicken.isAttackable()) {
                chicken.interact("Attack");
            }

the chicken id is same relevancy use as the name itself, I tried both name and ID.

also everything you see there was tried with and without pieces being shown.

What if the closest chicken is not attackable? Your script will just sit there and do nothing.

It should be something more like:

NPC chicken = getNpcs().closest(npc -> npc.getName().equals("Chicken") && npc.isAttackable());
if (chicken != null && chicken.interact("Attack")) {
    new ConditionalSleep(5000) {
        @Override
        public boolean condition() {
            return !chicken.isAttackable() || myPlayer().isInteracting(chicken);
        }
    }.sleep();
}

If that doesn't work it is something else in your script that is broken.

Edited by Explv

  • Author

I had the right code (besides the conditional sleeper) just my botstate enum check wasn't properly set to what it needed to be, fixed it though.

Thanks for inputs, i'm sure this'll help more people than just myself in future.

 

3 hours ago, Explv said:

What if the closest chicken is not attackable? Your script will just sit there and do nothing.

It should be something more like:


NPC chicken = getNpcs().closest(npc -> npc.getName().equals("Chicken") && npc.isAttackable());
if (chicken != null && chicken.interact("Attack")) {
    new ConditionalSleep(5000) {
        @Override
        public boolean condition() {
            return !chicken.isAttackable() || myPlayer().isInteracting(chicken);
        }
    }.sleep();
}

If that doesn't work it is something else in your script that is broken.

Should be this instead cause yours will attack multiple npcs at once within seconds timed.

if (!myPlayer().isUnderAttack() &&  chicken != null && chicken.interact("Attack")) {

 

Edited by Booleans YAY
quoting explv

1 hour ago, Booleans YAY said:

I had the right code (besides the conditional sleeper) just my botstate enum check wasn't properly set to what it needed to be, fixed it though.

Thanks for inputs, i'm sure this'll help more people than just myself in future.

 

Should be this instead cause yours will attack multiple npcs at once within seconds timed.


if (!myPlayer().isUnderAttack() &&  chicken != null && chicken.interact("Attack")) {

 

 

Well yes, obviously you will need to check your player isn't already attacking a chicken. I just didn't think it was necessary to write out the entire script

  • Author
2 minutes ago, Explv said:

 

Well yes, obviously you will need to check your player isn't already attacking a chicken. I just didn't think it was necessary to write out the entire script

Well I mean you did write out all of that but not include a few key strokes in the if statement, regardless minor miss oh well. Appreciated the support.

2 minutes ago, Booleans YAY said:

Well I mean you did write out all of that but not include a few key strokes in the if statement, regardless minor miss oh well. Appreciated the support.

Doesn't make sense to put it in the if statement though. It should be before you retrieve the closest chicken. Why look for a chicken if you aren't going to attack it?

39 minutes ago, Explv said:

Doesn't make sense to put it in the if statement though. It should be before you retrieve the closest chicken. Why look for a chicken if you aren't going to attack it?

cuz he uses booleans 2 attak chickenz bruh. First u gots 2 look 4 em den boolean em in closer cuz tis faster den filterz u kno? boolenz bro dey r the futere.

 

 

sry boolean but he gave you a snippet to help get you in a good direction, you don't have to follow it if you don't want but ya

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.