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.

Help making a barb fishing script?

Featured Replies

I'm trying to make a script that powerfishes leaping trout/salmon/sturgeon at otto's grotto. I'm new to Java, however, and there doesn't seem to be many, if any at all, tutorials for OSBot 2 scripting. Anyways, here's what I need help with:

 

- Upon starting the script the bot just stands there (URGENT!!!)

 

- Interacting with an Object (fishing spot) won't work for some reason

 

- Dropping (not sure what the code is for that, but if I can find it on the API please link smile.png )

 

- Antiban (Mousing over skills/changing tabs)

 

 

I use JDK 7 with IntelliJ IDEA

 

I'm not asking you guys to hold my hand on making this, but I am very new to Java (and even coding), and there doesn't seem to be much help for those who are "new" to the scene. Figured this would be a fun way to learn Java and play RS tho. Thanks!

 

What I have so far:

package org.igetbanned.barbfisher;

import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;

import java.awt.*;

/**
 * Created by ${igetbanned} on 8/30/2014.
 */
@ScriptManifest(
        author = "igetbanned",
        info = "Powerfishes barbarian style",
        name = "BarbarianFisher",
        version = 0.1,
        logo = "Cool"


)
public class BarbarianFIsher extends Script {

    public void onStart(){
        log("Barbarian Fisher Started!");
    }

    private enum State {
        FISHING, DROPPING, IDLE
    }

    private State getState() {
        if (inventory.isFull())
            return State.DROPPING;
        if (inventory.isEmptyExcept("Barbarian Rod", "Feather"))
            return State.FISHING;


        return State.IDLE;
    }

    public int onLoop() throws InterruptedException {
        switch (getState()) {
            case FISHING:
                Entity fishingspot = objects.closest("Fishing Spot");
                fishingspot.interact("Use-rod");
                    break;
            case DROPPING:
                    inventory.drop(11328, 11330);
                        break;
            case IDLE:
                sleep(random(500, 700));
                        break;

        }
            return random(200, 300);
    }


    public void onPaint(Graphics g) {

    }

    //code to be executed on exit
    public void onExit(){
        log("Script stopped!");
    }







}

Edited by igetbanned

Not holding hands, that's fine. Your getState is your script logic

Fishing spots are npc not object which is why it doesn't want to fish. (Add in a sleep conduction while it's fishing, else it will click the fishing spot).

You did the drop fine, but the logic doesn't make since because if your inventory is full. And you drop one fish, it won't be full anymore. So it will go back to fishing (You could add in an amount check, or add in a isn't animating Boolean check).

To help you debug, create a new string status. Then in the onLoop under each state add a new string stays = (status name). And in the onPaint display the new string status. It will help you debug your script so. If your in fishing mode and it doesn't fish then you know where to go an look to try to figure out your problem.

Edited by josedpay

To be honest I wouldn't recommend IntelliJ if you're new to Java. For me at least there were so many options and plug-ins that came with it it was a little overwhelming when I was new and tried to use it. Not only that, but I have yet to see a beginner Java tutorial using that IDE. I'd recommend Eclipse. A great Java tutorial (which you should watch before even attempting to script) can be found here.

 

P.S fishing spots are NPCs.

Guest
This topic is now closed to further replies.

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.