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 )
- 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!");
}
}