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.

Free script / snippet consulting service

Featured Replies

Free OSBot code

consulting service

 

Doubts about your overall logic or design?

Questions about how to optimize your product?

Want a second opinion before releasing your code baby publicly?

 

About

 

This is a free service to teach and learn, help improve and discuss scripts and snippets for the sake of improving the overall quality of scripts, especially (but most certainly not limited to) the ones made by fresh blood. Keep in mind, there's no shame in asking for a second opinion, we all have our weaknesses and strengths!

 

Submission guidelines

 

Feel free to post your source here, please make sure it's readable in terms of code formatting and presentation (use the code tag 4808b81e3d8029aed0d27261f924a7c0.png or pastebin). If you prefer a private consultation, feel free to PM one of the participating scripters (list below). In any case, please make sure the size of the project is reasonable, we will not be going through hundreds of classes (we wish we could, but we simply don't have the time).

 

Consultants

 

In case you don't want to make your code publicly visible, you can PM the following users for a more private consultation (please note that this is not the preferred way to go):

 

​Ex-Consultants

 

These consultants are, sadly enough, not active anymore, but still awesome and worth being listed here (don't PM them though):

 

Final notes

 

If you don't understand what you wrote in the first place, do not bother (we expect you to at least know what you tried to achieve with your code). Otherwise we'll more than gladly take a look at it. Don't be shy, there are no dumb questions as far as we're concerned (only dumb attitudes)! 

 

@Other script writers, especially the more experienced ones: feel free to constructively hijack this thread, but keep your negativity / frustration / arrogant behavior to yourselves, we all started from the bottom at some point. 

 

- Happy coding!

Edited by Botrepreneur

Yes, I feel we need more experienced scripters teaching good practices from bad ones. I've seen a couple scripts that don't even follow the onLoop() design pattern correctly, usually containing while loops that may never terminate. The onLoop() pattern was designed to attempt things once, and if failed, it should return and wait for the next call.

Hello! I'm glad someone decided to make this, directed towards n00bs like me tongue.png Allow me to break the ice -

 

I want to now add anti-ban onto my script that I just finished the functionality of, a simple barb fishing powerfisher

 

For starters I want it to open the skills tab and hover over the "Fishing" skill for a few seconds, here is what I have so far:

if (myPlayer().isAnimating()) {
                    sleep(500-6000);
                        getTabs();
                        open(Tab.SKILLS);
                            sleep(300-1200);

However IntelliJ is saying it cannot resolve method "open"

 

I then want it to hover over the "Fishing" skill, and I found after a google search this little snippet, submitted by a user who told another script writer to use the Parent and Child id's of the colors of the skills, and then hover over that. Here that is:

if (client.getInterface(parentId) != null) {
     client.getInterface(parentId).getChild(childId).hover();
}

Can't use client.getInterface() however, so now do I go about using MouseDestination?

 

Wonderful idea of this thread by the way! :D

  • Author
getTabs();
open(Tab.SKILLS);

What you want here is:

 

Instance.method()

 

Instead of:

 

Instance 

method()

(well you actually are trying to call the method on an instance here, but not the correct one, but I won't get into that)

 

You get the script's Tabs instance by calling getTabs() and then you call its method open(Tab) so:

getTabs().open(Tab.SKILLS);

 

But The API actually provides a method to hover over a skill, and it opens the tab for you if it isn't already open:

 

a5da8ec1ab0f6f5725999507ccd9e775.png

 

744c9d54d8727e9184de73ce5fd1fb27.png

 

683ebefe9eec715e76a9c2527206e379.png

 

getSkills() gets the Skills instance, what you could do is (again, Instance.method()):

 

getSkills().hoverSkill(Skill.FISHING);

 

Hope this helped, let me know if something wasn't crystal clear!

Edited by Botrepreneur

getTabs();
open(Tab.SKILLS);

What you want here is:

 

Instance.method()

 

Instead of:

 

Instance 

method()

(well you actually are trying to call the method on an instance here, but not the correct one, but I won't get into that)

 

You get the script's Tabs instance by calling getTabs() and then you call its method open(Tab) so:

getTabs().open(Tab.SKILLS);

 

But The API actually provides a method to hover over a skill, and it opens the tab for you if it isn't already open:

 

a5da8ec1ab0f6f5725999507ccd9e775.png

 

744c9d54d8727e9184de73ce5fd1fb27.png

 

683ebefe9eec715e76a9c2527206e379.png

 

getSkills() gets the Skills instance, what you could do is (again, Instance.method()):

 

getSkills().hoverSkill(Skill.FISHING);

 

Hope this helped, let me know if something wasn't crystal clear!

 

 

 

Works great :) just gotta adjust sleep time, moves too quick. I get the Instance.method(); now, makes sense :D Thanks!!

I'd be happy to help with this as well.

I don't want to steal yo thunder, Botre, but if you want to throw my name up there for an alternate contact you can. :)

  • Author

I'd be happy to help with this as well.

I don't want to steal yo thunder, Botre, but if you want to throw my name up there for an alternate contact you can. smile.png

 

Done :D!

Pin pls

I think if this gets a fair amount of traffic, it should be pinned.

But if nobody uses it, then I don't really see the point of pinning it. Know what I mean?

I think if this gets a fair amount of traffic, it should be pinned.

But if nobody uses it, then I don't really see the point of pinning it. Know what I mean?

I feel ya man.

Any idea how is better to implement automatically closing windows pattern? Like need close bank, equipment stats, etc. always except when action needs this window keep open? For example, close bank always except of then banking... the question is how convenient track if window needs to be closed or not?

Any idea how is better to implement automatically closing windows pattern? Like need close bank, equipment stats, etc. always except when action needs this window keep open? For example, close bank always except of then banking... the question is how convenient track if window needs to be closed or not?

Kind of confused as to what you're asking.

But you should only have the window open when you're dealing with it.

Like your bank won't be open if you're cutting trees, so you don't really have to worry about it.

Otherwise there are things such as:

if(Bank.isOpen()){

    Bank.close();

}

 

would check if the bank is open, and if it is it closes it.

If you're dealing with an interface that isn't already in the API you could write your own method using the interface ID's.

  • Author

Any idea how is better to implement automatically closing windows pattern? Like need close bank, equipment stats, etc. always except when action needs this window keep open? For example, close bank always except of then banking... the question is how convenient track if window needs to be closed or not?

 

If you are using a state machine you could have code like this running at the beginning of your state executor, for example:

if (!state.equals(State.Banking) && getBank().isOpen()) {
getBank().close();
}

But you shouldn't be worrying about that anyways (as explained by Nezz), there might be some cases when you could get stuck in an interface however, and then such design could prove to be a nice solution to your problem ^^

Edited by Botrepreneur

Nice thread here botre,

 

I know im not the most knowledgeable about java but i'd be happy to help, if anyone has a quick question just drop me a PM

 

-Apaec

 

 

 

Any idea how is better to implement automatically closing windows pattern? Like need close bank, equipment stats, etc. always except when action needs this window keep open? For example, close bank always except of then banking... the question is how convenient track if window needs to be closed or not?

I understand the question but it's a strange one to be asking.

I would be very interested to see how your script is formatted.

An example of how id expect to see this:

   public int loop() {
        final int RANDOM_ID = 666;

        if (Inventory.contains(RANDOM_ID)) {
            if (Bank.isOpen()) {
                Bank.close();
                //sleep
            } else {
                //do whatever it is you're doing in this example
            }
        } else {
            if (Bank.isOpen()) {
                //Use Bank
                //sleep
            } else {
                Bank.open();
                //sleep
            }
        }
        return 900;
    }

would be to run all your checks to see what you should be doing.

or use an Action/Task/Job system would also work .

eg:

 

Job Class (not sure what the api one here is (if any))

package Darkcore;

/**
 * Created by ISOLATE on 11/09/14.
 */
public abstract class Job {
    
    public abstract boolean Activate();
    public abstract void Run();
    
}
 

 

Example Banking Inheritance

public class Banking extends Job {
    @Override
    public boolean Activate() {
        return Inventory.isFull();
    }

    @Override
    public void Run() {
        if (Variables.BANK_AREA.contains(getMyPlayer())) {
            if (Bank.isOpen()) {
                Bank.depositInventory();
                Time.sleep(300, 700);
            } else {
                Bank.open();
                Time.sleep(200, 800);
            }
        } else {
            //Walk to bank
        }
    }
} 

 

 

Edited by Isolate

Guest
This topic is now closed to further replies.

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.