Can someone please convert this or whatever into a RSBot script?
/beg
/beg
Code:
import java.awt.*;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.PaintListener;
public class ShiloFisher extends Script implements PaintListener {
/*
By S3BASTI3N
How to use: start at the Shilo bank or fishingspot and start the script.
*/
public int Fish1 = 331; //trout
public int Fish2 = 335; //salmon
public int FishingSpot = 317;
public int BankGuy = 499;
public int Gear1 = 309; //Net
public int Feathers = 314; //Feathers
int[] NonDeposits = {Gear1, Feathers};
private int GambleInt = 0;
private int Gear = 0;
private int Trys = 0;
private int Drop = 0;
private int Walking = 0;
private int Death = 0;
private int TimesLost = 0;
private int UnderAttack = 0;
private int NotFound = 0;
private int Finding = 0;
private int Guess = 0;
private int Fish1Count = 0;
private int Fish2Count = 0;
private int Fish3Count = 0;
private int Fish4Count = 0;
private long startTime = System.currentTimeMillis();
Color WHITE = new Color(255, 255, 255, 200);
Color GREEN = new Color(0, 50, 10, 255);
//================================================================
private final RSTile[] ToBankTiles = {
new RSTile(2865, 2971), new RSTile(2853, 2972),
new RSTile(2844, 2969), new RSTile(2835, 2969),
new RSTile(2843, 2963), new RSTile(2852, 2954)};
private final RSTilePath ToBank = new RSTilePath(ToBankTiles, this);
//=========================================================================================
private final RSTile[] ToFishTiles = {
new RSTile(2852, 2954), new RSTile(2849, 2964),
new RSTile(2851, 2970), new RSTile(2858, 2971)};
private final RSTilePath ToFish = new RSTilePath(ToFishTiles, this);
//=========================================================================================
public double getVersion() {
return (1.4);
}
public String getName() {
return "Shilo Fisher";
};
public String getAuthor() {
return "S3BASTI3N";
}
public String getScriptCategory() {
return "Fishing";
}
public void onRepaint(Graphics g) { //stole transparent box from Alex's AlFlax
if (isLoggedIn()) {
int x = 310;
int y = 20;
long millis = System.currentTimeMillis() - startTime;
long hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
long minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
long seconds = millis / 1000;
g.setColor(WHITE);
g.fill3DRect(300, 20, 200, 120, true);
g.setColor(GREEN);
g.drawString(getName() + " by "+getAuthor(), x, y += 20);
if (Fish1Count > 0) {
g.drawString(" Trout banked: "+ Fish1Count +"", x, y += 20);
}
if (Fish2Count > 0) {
g.drawString(" Salmon banked: "+ Fish2Count +"", x, y += 20);
}
}
}
public boolean onStart(String[] args) {
Bot.getEventManager().addListener(PaintListener.class, this);
Gear = Gear1;
return true;
}
public int loop() {
if (distanceTo(new RSTile(2848, 2970)) >= 30) {
log("We are lost logging out.");
Lost();
}
if ((getMyPlayer().getAnimation() == 621) || (getMyPlayer().getAnimation() == 623)) {
Wait();
}
if (getMyPlayer().isInCombat()) {
log("\n Oh No!!! we are under attack!!!! \n Run for your life!!!");
UnderAttack++;
runAway();
}
if (Walking > 0) {
if (Walking == 1) {
WalkToBank();
wait (random(1000, 2000));
return 1;
}
if (Walking == 2) {
WalkToFish();
wait (random(1000, 2000));
return 1;
}
}
if (getMyPlayer().isMoving()) {
return random (1000, 3000);
}
PickUp();
RSNPC bank = getNearestNPCByID(BankGuy);
if ((getInventoryCount() == 2) && (bank != null)) {
WalkToFish();
}
if ((getInventoryCount() > 2) && (bank !=null)) {
Bank();
return 1;
}
if ((isInventoryFull()) || (Drop == 1)) {
DropFish();
if ((!inventoryContains(Fish1)) &&
(!inventoryContains(Fish2))) {
return random (1000, 2000);
}
}
if ((getMyPlayer().getAnimation() == -1) &&
(inventoryContains(Gear)) &&
(!isInventoryFull()) &&
(Death == 0) &&
(Drop == 0)) {
Fish();
}
return random (200, 500);
}
public void Wait() { //also antiban
if (getMyPlayer().isInCombat()) {
log("\n Oh No!!! we are under attack!!!! \n Run for your life!!!");
UnderAttack++;
runAway();
}
if ((getMyPlayer().getAnimation() == 621) || (getMyPlayer().getAnimation() == 623)){
wait (random(1000, 2000));
GambleInt = random(1, 10);
if ((GambleInt == 1) || (GambleInt == 2) || (GambleInt == 3)) {
wait(random(2000, 2000));
}
if (GambleInt == 4) {
openTab(TAB_STATS);
}
if (GambleInt == 5) {
openTab(TAB_INVENTORY);
}
if (GambleInt == 6) {
openTab(TAB_FRIENDS);
}
if ((GambleInt == 7) || (GambleInt == 8) || (GambleInt == 9)) {
int x = random(0, 750);
int y = random(0, 500);
moveMouse(0, 0, x, y);
}
}
}
public void DropFish() {
if (isInventoryFull()) {
WalkToBank();
}
}
public void Fish() {
log("Finding new fishing spot...");
RSNPC npc = getNearestNPCByID(FishingSpot);
if (inventoryContains(Gear1)) {
if (npc != null) {
atNPC(npc, "Lure");
NotFound = 0;
wait (random(2000, 5000));
}
if (npc == null) {
NotFound++;
wait (random(2000, 4000));
}
if (NotFound > 5) {
RSTile Now, New;
if ((distanceTo(new RSTile(2867, 2971)) < 5) && (Finding == 0)) { // X 1
Now = getMyPlayer().getLocation();
setRun(true);
New = new RSTile(Now.getX()-random(7,10),Now.getY());
walkTileMM(New);
wait(random(1500,2500));
Finding = 1;
}
if ((distanceTo(new RSTile(2852, 2971)) < 5) && (Finding == 0)) { // X 2
GambleInt = (random(1,3));
if (GambleInt == 1) {
Guess = -(random(7, 10));
}
if (GambleInt == 2) {
Guess = (random(7, 10));
}
Now = getMyPlayer().getLocation();
setRun(true);
New = new RSTile(Now.getX()-Guess,Now.getY());
walkTileMM(New);
wait(random(1500,2500));
Finding = 1;
}
if ((distanceTo(new RSTile(2834, 2970)) < 5) && (Finding == 0)) { // X 3
Now = getMyPlayer().getLocation();
setRun(true);
New = new RSTile(Now.getX()+random(7,10),Now.getY());
walkTileMM(New);
wait(random(1500,2500));
Finding = 1;
}
Finding = 0;
}
}
}
public void runAway() { // running away and running back after a while
RSTile Current, GoingTo;
Current = getMyPlayer().getLocation();
setRun(true);
GoingTo = new RSTile(Current.getX()+random(8,10),Current.getY()+random(8,10));
walkTileMM(GoingTo);
while(getMyPlayer().isMoving()) {
wait(random(2000,4000));
}
wait(random(3000,5000));
walkTileMM(Current);
}
public void PickUp() {
if (inventoryContains(Gear)) {
if (!inventoryContains(Feathers)) {
log("Out of Feathers, logging out");
Bank();
}
}
if (!inventoryContains(Gear)) {
log("Lost Gear!");
RSItemTile item = getGroundItemByID(Gear);
getGroundItemByID(Gear);
atTile(item, "take");
wait (random(2000, 4000));
if (!inventoryContains(Gear)) {
Trys++;
if (Trys >= 5) {
log("Could not find the gear");
Bank();
}
}
if (inventoryContains(Gear)) {
log("Picked up the right gear...");
Trys = 0;
}
}
}
public void Lost() {
clickMouse(754, 13,3 ,3 , true);
wait(random(1000, 2000));
clickMouse(647, 376 ,50, 15, true);
stopAllScripts();
}
public void Bank() {
RSNPC bank = getNearestNPCByID(BankGuy);
if (bank != null) {
if (!interfaceExists(INTERFACE_BANK)) {
atNPC(bank, "Bank Ba");
wait (random(500, 1000));
}
if (interfaceExists(INTERFACE_BANK)) {
if (isInventoryFull()) {
Fish1Count += getInventoryCount(Fish1);
Fish2Count += getInventoryCount(Fish2);
depositAllExcept(NonDeposits);
}
if (!inventoryContains(Feathers)) {
atBankInventoryItem(Feathers, "x");
typeX();
}
if (!inventoryContains(Gear)) {
atBankInventoryItem(Gear, "1");
}
}
closeBank();
}
}
public void typeX() {
int[] randomtype = new int[] { 100, 150, 200, 300, 400, 1000, 1000};
int Amount = randomtype[random(0, randomtype.length)];
wait (random(500, 700));
sendText("" + Amount, true);
}
public void WalkToBank() {
Walking = 1;
if (distanceTo(ToBankTiles[ToBankTiles.length-1]) < 3) {
Walking = 0;
Bank();
} else {
walkPathMM(randomizePath(ToBankTiles, 2, 2), 15);
}
}
public void WalkToFish() {
Walking = 2;
if (distanceTo(ToFishTiles[ToFishTiles.length-1]) < 3) {
Walking = 0;
Drop = 0;
} else {
walkPathMM(randomizePath(ToFishTiles, 2, 2), 15);
}
}
}

