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.

When entering combat.

Featured Replies

Hi,

i am writing a script that loots a ground item and then world hops and repeats. When the player enters combat it runs to a safespot waits for combat delay hops world and tries again. This works but i notice it bugs out when the script is in the middle of an iteraction or world hopping etc...

I would like the script to stop whats its doing as soon as it enters combat and move to the safespot.

What would be the correct way to achieve this.

Thanks in advance.

        if(getSkills().getDynamic(Skill.HITPOINTS) < 6){
            if(ItemCountInInventory() <= 14){
                paint.setCurrentStatus("regenerating some health");
                WalkExact(SAFE_SPOT);
                sleep(60_000);
            }
        } else if(!myPlayer().isUnderAttack()){
            TakeItem(item, position, ItemCountInInventory());
        } else if (myPlayer().isUnderAttack()) {
            WalkExact(SAFE_SPOT);
            sleep(5000);
            getWorlds().hop(nextWorldInOrder(true));
        }
    private void TakeItem(GroundItem item, Position position, long inventoryCount){
        paint.setCurrentStatus("Looting item :" + ItemCountInInventory());
        if(item == null || !position.equals(item.getPosition())){
            getWorlds().hop(nextWorldInOrder(true));
        } else {
            item.interact("Take");
            Sleep.sleepUntil(() -> inventoryCount < ItemCountInInventory(), 5000, 100);
            log("InventoryCount " + ItemCountInInventory());
        }
    }

 

Edited by PandieDev

Sleep.sleepUntil(() -> myPlayer().isUnderAttack() || inventoryCount < ItemCountInInventory(), 5000, 100);

If you want it to stop walking when attacked youll need to make an event

 

  • Author
1 minute ago, skillerkidos1 said:
Sleep.sleepUntil(() -> myPlayer().isUnderAttack() || inventoryCount < ItemCountInInventory(), 5000, 100);

Hi, Thanks for the reply.

That is indeed an oversight on my part.

But how would this workd with  hopping world? i assume i would need to write the hopping myself ?

getWorlds().hop();

 

3 minutes ago, PandieDev said:

Hi, Thanks for the reply.

That is indeed an oversight on my part.

But how would this workd with  hopping world? i assume i would need to write the hopping myself ?

getWorlds().hop();

 

getWorlds().hopToP2PWorld();
  • Author
11 minutes ago, PandieDev said:

Hi, Thanks for the reply.

That is indeed an oversight on my part.

But how would this workd with  hopping world? i assume i would need to write the hopping myself ?

getWorlds().hop();

 

Sorry my question might not be clear. I have the hopping itself.

But when its hopping (scrolling the world list, selecting the world, etc... ) When it gets attacked then it just stands there.

you could try something with onMessage if it says the cant hop msg sleep 10 seconds
 

@Override
public void onMessage(Message msg) throws InterruptedException {}
  • Author
20 minutes ago, skillerkidos1 said:

you could try something with onMessage if it says the cant hop msg sleep 10 seconds
 

@Override
public void onMessage(Message msg) throws InterruptedException {}

it seems that the break condition does help.

 

public boolean hop(int world,
                   java.util.concurrent.Callable<java.lang.Boolean> breakCondition)

Hops to the specified world id if the destination is not already the world you are in.

Parameters:
    breakCondition - Return true to break the hopping process 

Is there any way to make the world hopping instant like it is with keybinds on runelite?

Make the script BREAK the event when in combat. Add this to all events. Run the "walk to safespot" event on a different thread.

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.