Guys here is the fix for the bot Dialogues has been added when going from port sarim to karamja.
Btw im new here
import org.osbot.rs07.api.model.Entity;
import org.osbot.rs07.api.model.Item;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.api.map.Position;
import org.osbot.rs07.api.ui.Skill;
import java.awt.*;
import java.awt.Font;
import java.util.concurrent.TimeUnit;
import static org.osbot.rs07.api.ui.Skill.FISHING;
@ScriptManifest(author = "Strange's Simple Script's",
info = "It catches lobsters in Karjama and deposits it. However the quest PIRATES TREASURE is required for it to work.",
name = "Karajama Lobster Catcher and Banker",
version = 1.3,
logo = "")
public class Lobster extends Script {
private String rodName;
private String baitName;
private String fishID;
private Position[] underAttack = {new Position(3087, 3227, 0)};
private Position[] toBank = {new Position(3092, 3236, 0), new Position(3092, 3245, 0)};
private Position[] toFish = {new Position(3084, 3236, 0)};
private int getYVal = (3167 + random(0, 2));
private int getXVal = (2920 + random(0, 2));
private Position[] lobsToPay = {
new Position(2923 + random(0, 2), 3172 + random(0, 2), 0),
new Position(getXVal, getYVal, 0),
new Position(getXVal + random(0, 1), getYVal - random(6, 8), 0),
new Position(getXVal - random(0, 2), getYVal - random(12,14), 0),
new Position(2916 + random(0, 4), 3153 - random(0, 2), 0),
new Position(2925 + random(0, 2), 3152 - random(0, 2), 0),
new Position(2935 + random(0, 2), 3148 + random(0, 2), 0),
new Position(2941 + random(0, 1), 3145 + random(0, 2), 0 )
}; //fish to sea 2
private Position[] toDepositBox = {
new Position(3027 +random(0, 2), 3224 + random(0, 2), 0),
new Position(3026 + random(0, 2), 3233 + random(0, 2), 0),
new Position(3035 + random(0, 2), 3235 + random(0, 2), 0),
new Position(3043 + random(0, 3), 3235 + random(0, 1), 0)
};
private Position[] fromDepositBox = {
new Position(3035 + random(0, 2), 3235 + random(0, 2), 0),
new Position(3026 + random(0, 2), 3233 + random(0, 2), 0),
new Position(3027 +random(0, 2), 3224 + random(0, 2), 0)
};
private Position[] shipToLobs = {
new Position(2947 + random(0, 1), 3146 + random(0, 1), 0),
new Position(2941 + random(0, 1), 3145 + random(0, 2), 0 ),
new Position(2935 + random(0, 2), 3148 + random(0, 2), 0),
new Position(2925 + random(0, 2), 3152 - random(0, 2), 0),
new Position(2916 + random(0, 4), 3153 - random(0, 2), 0),
new Position(getXVal - random(0, 2), getYVal - random(12,14), 0),
new Position(getXVal + random(0, 1), getYVal - random(6, 8), 0),
new Position(getXVal, getYVal, 0),
new Position(2923 + random(0, 2), 3172 + random(0, 2), 0),
new Position(2924 + random(0,1), 3175 + random(0, 5), 0)
};
private String bankID;
public int bBooth = 11744;
public int startExp;
public int currentExp;
public int expGained;
public int lobsCaught;
private long timeBegan;
private long timeRan;
private int anchCaught = 0;
private int shrimpCaught = 0;
public void onStart() {
timeBegan = System.currentTimeMillis();
startExp = skills.getSkills().getExperience(FISHING);
this.bankID = "11744";
this.rodName = "Lobster pot";
this.baitName = "Feather";
this.fishID = "Fishing spot";
this.log("Karajama Lobster Catcher and Banker Started");
}
public int onLoop() throws InterruptedException {
State current = this.getState();
//this.log(current.toString());
switch (current) {
case FISH:
this.fish();
break;
case FISHING:
this.fishing();
this.antiBan();
break;
case TODEPOSIT:
this.toDepositBox();
break;
case BANKING:
this.banking();
break;
case FISHTOPORT:
this.walkToBank();
break;
case WALKTOFISH:
this.walkToFish();
break;
case ONSHIP:
this.onShip();
break;
case FROMDEPOSIT:
this.fromDepositBox();
break;
case BANANATIME:
this.bananaTime();
break;
case IDLE:
break;
}
return gRandom(200, 1000);
}
public void onPaint(Graphics2D g) {
Graphics2D gr = g;
currentExp = skills.getExperience(Skill.FISHING);
expGained = currentExp - startExp;
lobsCaught = expGained / 90;
timeRan = System.currentTimeMillis() - this.timeBegan;
Font normal = new Font("SANS_SERIF", Font.BOLD, 14);
Font italic = new Font("SANS_SERIF", Font.ITALIC, 12);
g.setColor(Color.ORANGE);
g.setFont(normal);
g.drawString("Strange's Lobster Catcher 'n Banker", 8, 30);
g.drawString("Time Elapsed: " + ft(timeRan), 8, 45);
g.drawString("Fishing Exp Gained: " + expGained, 8, 60);
g.drawString("Lobsters Caught: " + lobsCaught, 8, 75);
g.setFont(italic);
g.drawString(this.getState().toString(), 8, 90);
}
private String ft(long duration) {
String res = "";
long days = TimeUnit.MILLISECONDS.toDays(duration);
long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
if (days == 0) {
res = (hours + ":" + minutes + ":" + seconds);
} else {
res = (days + ":" + hours + ":" + minutes + ":" + seconds);
}
return res;
}
public void onExit() {
this.log("Shrimp Catcher and Banker ended!");
}
public void fish() throws InterruptedException {
Entity fishin = objects.closest(1522);
boolean mousePos = mouse.isOnCursor(fishin);
NPC fishingSpot = npcs.closest(1522);
if (random(1, 20) == 1) {
fishingSpot.hover();
mouse.click(mousePos);
sleep(random(300, 1750));
this.log("Mouseclick Anti");
} else {
fishingSpot.interact("Cage");
sleep(random(300, 1750));
}
}
public void fishing() throws InterruptedException {
if (!this.myPlayer().isUnderAttack() & !this.getInventory().isFull() & this.myPlayer().isAnimating() && mouse.isOnScreen()) {
mouse.moveRandomly();
mouse.moveOutsideScreen();
sleep(random(300, 1211));
} else sleep(300);
}
public void toDepositBox() throws InterruptedException {
getLocalWalker().walkPath(toDepositBox);
localWalker.waitUntilIdle();
sleep(random(300,500));
}
public void fromDepositBox() throws InterruptedException {
Entity toKar = npcs.closest(3646, 3645, 3644);
if(toKar ==null && !myPlayer().isMoving()) {
localWalker.walkPath(fromDepositBox);
getLocalWalker().waitUntilIdle();
sleep(random(300, 677));
}
if(toKar !=null) {
toKar.interact("Pay-Fare");
dialogues.completeDialogue();
dialogues.completeDialogue("Yes please.");
sleep(random(377, 989));
}
}
public void walkToBank() throws InterruptedException {
Object bankB = objects.closest("Bank deposit box");
NPC seaman = npcs.closest(3648);
Entity bB = objects.closest(26254);
Entity ship = npcs.closest(3648);
if (seaman ==null) {
localWalker.walkPath(lobsToPay);
getLocalWalker().waitUntilIdle();
} else if (!myPlayer().isMoving()) {
seaman.interact("Pay-Fare");
dialogues.completeDialogue();
dialogues.completeDialogue("Can I journey on this ship?");
dialogues.completeDialogue("Search away, I have nothing to hide.");
dialogues.completeDialogue("Ok.");
sleep(random(300, 500));
}
}
public void banking() throws InterruptedException {
if (!this.getDepositBox().isOpen() && this.getInventory().isFull() && !this.myPlayer().isMoving()) {
switch (random(1, 2)) {
case 1:
this.log("Bank case 1");
objects.closest(26254).interact("Deposit");
sleep(random(977, 1777));
break;
case 2:
Entity enDepot = objects.closest(26254);
boolean depotPos = mouse.isOnCursor(enDepot);
camera.movePitch(random(56, 67));
camera.moveYaw(random(28, 132));
sleep(random(600, 1136));
enDepot.hover();
sleep(random(266, 377));
mouse.click(depotPos);
this.log("Bank case 2");
sleep(random(457, 789));
break;
}
sleep(random(878, 1321));
}
if (this.getDepositBox().isOpen()) {
this.getDepositBox().depositAllExcept("Lobster pot", "Coins");
sleep(random(377, 544));
this.getDepositBox().close();
sleep(random(99, 1111));
}
sleep(random(100, 500));
}
public void walkToFish() throws InterruptedException {
if (getInventory().onlyContains("Lobster pot", "Coins")) {
localWalker.walkPath(shipToLobs);
getLocalWalker().waitUntilIdle();
sleep(random(987, 1429));
}
if (myPlayer().isMoving()) {
sleep(random(563, 1218));
}
}
public void onShip() throws InterruptedException {
Object plankID = objects.closest("Gangplank");
Entity plank = objects.closest("Gangplank");
if (myPosition().getZ() == 1 && !myPlayer().isMoving() && !myPlayer().isAnimating()) {
plank.interact("Cross");
sleep(random(577, 1117));
}
sleep(random(321, 673));
}
public void bananaTime() throws InterruptedException {
Item banana = inventory.getItem(1963);
if (getInventory().contains(1963)) {
switch(random(1, 2)) {
case 1:
banana.interact("Eat");
break;
case 2:
banana.interact("Drop");
}
}
}
public void antiBan() throws InterruptedException {
if (random(0, 10) == 1) {
switch (random(0, 6)) {
case 0:
this.camera.movePitch(gRandom(20, 60));
this.log("Antiban: 0");
break;
case 1:
this.getTabs().getSkills().open();
this.getSkills().hoverSkill(FISHING);
this.log("Antiban: 1");
sleep(random(1111, 2777));
break;
case 2:
this.camera.moveYaw(110 + random(25, 80));
this.log("Antiban: 2");
break;
case 3:
this.camera.moveYaw(random(1, 359));
this.log("Antiban: 3");
break;
case 4:
this.getMouse().moveOutsideScreen();
sleep(random(3333, 5473));
this.log("Antiban: 4");
break;
case 5:
this.mouse.moveRandomly();
this.log("Antiban: 5");
break;
case 6:
this.log("Antiban: 6");
switch (random(1, 7)) {
case 1:
this.getTabs().open(Tab.ATTACK);
break;
case 2:
this.getTabs().open(Tab.QUEST);
break;
case 3:
this.getTabs().open(Tab.EQUIPMENT);
break;
case 4:
this.getTabs().open(Tab.PRAYER);
break;
case 5:
this.getTabs().open(Tab.MAGIC);
break;
case 6:
this.getTabs().open(Tab.FRIENDS);
break;
case 7:
this.getTabs().open(Tab.SETTINGS);
break;
}
sleep(random(2377, 4556));
}
sleep(random(186, 987));
if (random(1, 5) ==1) {
this.getTabs().open(Tab.INVENTORY);
}
}
}
public State getState() {
NPC fishingSpot = npcs.closest(1522);
if (!this.getInventory().isFull() && !this.myPlayer().isAnimating() && !this.myPlayer().isUnderAttack() && myPosition().getY() > 3171 && fishingSpot != null) {
return State.FISH;
} else if (!this.getInventory().isFull() && this.myPlayer().isAnimating() && !this.myPlayer().isUnderAttack()) {
return State.FISHING;
} else if (myPlayer().isUnderAttack() && !this.getInventory().isFull()) {
return State.EVADING;
} else if (this.getInventory().isFull() && myPosition().getX() < 3000 && myPosition().getZ() == 0) {
return State.FISHTOPORT;
} else if (this.getInventory().isFull() && objects.closest(26254) != null && !this.myPlayer().isMoving() && myPosition().getX() > 3039) {
return State.BANKING;
} else if (this.myPosition().getY() < 3172 && this.getInventory().onlyContains("Lobster pot", "Coins") && myPosition().getX() < 3000 && myPosition().getZ() == 0) {
return State.WALKTOFISH;
} else if (myPosition().getZ() == 1) {
return State.ONSHIP;
} else if (myPosition().getZ() == 0 && myPosition().getX() > 3000 && getInventory().isFull()) {
return State.TODEPOSIT;
} else if (myPosition().getZ() == 0 && myPosition().getX() > 3000 && !getInventory().isFull()) {
return State.FROMDEPOSIT;
} else if (this.getInventory().contains(1963)) {
return State.BANANATIME;
}
return State.IDLE;
}
public enum State {
FISH, FISHING, EVADING, FISHTOPORT, BANKING, IDLE, WALKTOFISH, ONSHIP, TODEPOSIT, FROMDEPOSIT, BANANATIME
}
}