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.

Programming preemptive interaction

Featured Replies

Disclaimer All pseudo code

(Wouldn't mind real code answers :) ) 

 

I'd love some help knowing how to program pre emptive mouse hovering and interaction. I haven't familiarized myself with the API, so I've just been considering the logic of these things.

Such as when the bot is running toward an area, and it has already clicked on the intractable object contained within the area it's running to. 

(and allows the player to run toward the object via interaction running)

if (myplayer.distance(areaOfObject) < 6){

object.interact;

}

or while fighting a monster, hovering the mouse over the next monster to attack.

This one i thought you may want to define 2 variables - one is closest npc and other is a 2nd closest npc?  Any thoughts on this?

if (closestMonster.gethealth(<30)){
getMouse.hover(secondMonster);
}

The only issue with the above is that the 2nd monster would be changing constantly (due to distance '.closest') unless theres a way to make a variable static based upon monster 1.

Like whoever is 2nd closest at that moment is assigned as a new variable (nextTarget).

Would also have to check their distance and status to ensure the bot doesnt attack something which is being attack by another player AFTER the assignment to the nextTarget variable.

-quite complex, i may be overthinking it. My initial reasoning for implementing these features was antiban, but upon enlightenment of its uselessness I think this functionality techniques would make things happen faster. Which would be very useful with a large scale gold farm.

Thanks guys.

As i typed 'thanks guys' I questioned : is there a single female on this website as a dev? Not to assume gender roles (lol) but lets be honest this is a pretty male nerd place to be.

Edited by WhatIfand
punctuation

For breaking early based on distance, you'll want to use a WalkingEvent (or WebWalkingEvent) and set a break condition for the event. It could be something as simple as

Supplier<NPC> npcFinder = () -> getNpcs().closest(f -> f.getName().equals("NpcToFind") && f.getPosition() != null && f.getPosition().distance(myPosition()) <= 7 && getMap().canReach(f));
Condition breakCondition = new Condition() {
  @Override
    public boolean evaluate() {
    return npcFinder.get() != null;
  }
};
new WalkingEvent(myPos).setBreakCondition(breakCondition).execute();
NPC targetNpc = npcFinder.get();
if (targetNpc != null)
  if (targetNpc.interact())
  //Do stuff

This will break out of your walking event as soon as the NPC is able to be reached, and interact with it.

 

You'll use a similar concept for hovering the next monster to attack. In the execution of your combat-block, determine if the NPC you're fighting is about to die, and if so, find the next target and hover over it. You'll need to constantly validate that it's a valid target and isn't in combat with another player.

  • Author
19 hours ago, NoxMerc said:

For breaking early based on distance, you'll want to use a WalkingEvent (or WebWalkingEvent) and set a break condition for the event. It could be something as simple as


Supplier<NPC> npcFinder = () -> getNpcs().closest(f -> f.getName().equals("NpcToFind") && f.getPosition() != null && f.getPosition().distance(myPosition()) <= 7 && getMap().canReach(f));
Condition breakCondition = new Condition() {
  @Override
    public boolean evaluate() {
    return npcFinder.get() != null;
  }
};
new WalkingEvent(myPos).setBreakCondition(breakCondition).execute();
NPC targetNpc = npcFinder.get();
if (targetNpc != null)
  if (targetNpc.interact())
  //Do stuff

This will break out of your walking event as soon as the NPC is able to be reached, and interact with it.

 

You'll use a similar concept for hovering the next monster to attack. In the execution of your combat-block, determine if the NPC you're fighting is about to die, and if so, find the next target and hover over it. You'll need to constantly validate that it's a valid target and isn't in combat with another player.

Simple enough. Appreciate the response man.

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.