IxIGreyFoxIxI
Member
- Joined
- Feb 12, 2009
- Sythe Gold
- 0
- Messages
- 25
Does anyone have a working flax spinner and banker? For Lumbridge or Seer's. I just autoed 6000 to find that my spinner didn't work 
He wants a script, not someone to do it for him, dumbass.i can spin them for u for free i just want a vouch in return if u want me 4 da job message me thankx
He wants a script, not someone to do it for him, dumbass.
Here's the script I use, almost flawless. Not gonna post it cause code tags don't work on Sythe, so I uploaded it to Pastebin for you.
http://pastebin.com/f495eac56
Just click download and save it as LumbFlaxSpinner.java.
NP, glad to helpThanks man!
It's working good. The banking is a little gay ;D
import java.awt.*;
import java.util.ArrayList;
import com.speljohan.rsbot.bot.*;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
import com.speljohan.rsbot.event.listeners.*;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.script.wrappers.*;
public class LumbFlaxSpinner extends Script implements PaintListener,
ServerMessageListener {
boolean proggy = false;
long startTime = System.currentTimeMillis();
int stringsBanked = 0;
int bankFail = 0;
final int FLAX_ID = 1779;
final int BOW_STRING_ID = 1777;
final int DOOR_CLOSE_ID = 36844;
final int BOW_STRING_CHILD_ID = 17;
final int SPINNING_WHEEL_ID = 36785;
final int SPINNING_INTERFACE_ID = 459;
final int BANK_ID = 36786;
final Color BG = new Color(123, 123, 123, 100);
final Color GREEN = new Color(0, 255, 0, 255);
final Color RED = new Color(255, 0, 0, 255);
final RSTile bankTile = new RSTile(3208, 3220);
final RSTile DOOR_CLOSE_TILE = new RSTile(3207, 3214);
final RSTile STAIRCASE_TILE = new RSTile(3205, 3208);
public String getName() {
return "Lumbridge Flax Spinner";
}
public double getVersion() {
return 3.7;
}
public String getAuthor() {
return "..:loading:../mike/DreaDz";
}
public String getScriptCategory() {
return "Flaxspinner";
}
public String getScriptDescription() {
return "<html>\n" + "<head></head>\n" + "<body>\n" + "<center>"
+ "<h2>"
+ getName()
+ "</h2>"
+ "</center>\n"
+ "<b>Author:</b> "
+ getAuthor()
+ "<br/>\n"
+ "<b>Version:</b> "
+ getVersion()
+ "<br/>\n"
+ "<br/>\n"
+ "<b>Starting Location:</b> Lumbridge Bank & put Flax in <u>first</u> bank slot.<br/>"
+ "<b>Function:</b> Spins Flax."
+ "<br/>"
+ "<b>Version Notes:</b> "
+ "<ul>"
+ "<li>"
+ "<b>3.7:</b> Fix"
+ "<br>"
+ " - Fixed not going upstairs when being attacked. (credits to alowaniak for combat detection)"
+ "<li>"
+ "<b>3.6:</b> Fixes by mehhh"
+ "<br>"
+ " - Fixed getting stuck on stairs, spinning room, and in bank."
+ "<li>"
+ "<b>3.5:</b> More Fixes by mehhh"
+ "<br>"
+ " - Fixed running into the spinning room after opening the door. -- credits to <i>endoskeleton</i>."
+ "<br>"
+ " - Banks a LOT better."
+ "<br>"
+ " - Runs away from combat -- credits to <i>alowaniak</i>."
+ "<br>"
+ "<li>"
+ "<b>3.0:</b> Fixes"
+ "<br>"
+ " - Runs In Lumbridge"
+ "<br>"
+ " - Includes DeathWalk"
+ "<br>"
+ "<li>"
+ "<b>2.0:</b> Total Rewrite"
+ "</li>"
+ "<li>"
+ "<b>1.0:</b> First Version"
+ "<br>"
+ " - Runs in Camelot"
+ "<br>"
+ " - Short Lived. Horrible script that just did the job."
+ "</li>" + "<li>" + "<b>0.*:</b> Beta Versions" + "</li>" +
"</ul>" + "</body>\n" + "</html>";
}
public boolean onStart(String[] args) {
bankFail = 0;
proggy = true;
startTime = System.currentTimeMillis();
stringsBanked = 0;
Bot.getEventManager().addListener(PaintListener.class, this);
Bot.getEventManager().addListener(ServerMessageListener.class, this);
return true;
}
public void logoutFor(int i) {}
public void onFinish() {
Bot.getEventManager().removeListener(PaintListener.class, this);
Bot.getEventManager().removeListener(ServerMessageListener.class, this);
}
public RSTile bankTile() {
return new RSTile(random(3208, 3209), random(3219, 3220));
}
public RSTile staircaseTile() {
return new RSTile(random(3205, 3207), random(3205, 3209));
}
public boolean isInSpinningRoom() {
RSTile myLocation = getMyPlayer().getLocation();
int myX = myLocation.getX();
int myY = myLocation.getY();
if (myX >= 3208 && myX <= 3212 && myY >= 3211 && myY <= 3217
&& getPlane() == 1) {
return true;
}
return false;
}
public boolean isInArea(int maxX, int minY, int minX, int maxY) {
int x = getMyPlayer().getLocation().getX();
int y = getMyPlayer().getLocation().getY();
if (x >= minX && x <= maxX
&& y >= minY && y <= maxY) {
return true;
}
return false;
}
public boolean isInBank() {
RSTile myLocation = getMyPlayer().getLocation();
int myX = myLocation.getX();
int myY = myLocation.getY();
if (myX >= 3208 && myX <= 3209 && myY >= 3215 && myY <= 3220
&& getPlane() == 2) {
return true;
}
return false;
}
public RSTile spinningRoomTile() {
return new RSTile(random(3209, 3210), random(3213, 3213));
}
public RSTile outsideDoor() {
return new RSTile(random(3205, 3207), random(3208, 3219));
}
public boolean isDoorClosed() {
if (getPlane() == 1 && !isInSpinningRoom()) {
if (Calculations.canReach(spinningRoomTile(), true)) {
return false;
}
}
if (getPlane() == 1 && isInSpinningRoom()) {
if (Calculations.canReach(staircaseTile(), true)) {
return false;
}
}
return true;
}
public boolean walkToTile(RSTile tile) {
if (walkPathMM2(generatePath(tile), 17)) {
return true;
}
return false;
}
public int flaxCount() {
return getInventoryCount(FLAX_ID);
}
public int bowstringCount() {
return getInventoryCount(BOW_STRING_ID);
}
public int loop() {
if (getMyPlayer().isMoving()) {
return random(500, 550);
}
try {
int height = getPlane();
if (!RSInterface.getInterface(SPINNING_INTERFACE_ID).isValid()) {
if (flaxCount() == 0) {
atInterface(SPINNING_INTERFACE_ID, 12);
} else if (!bank.getInterface().isValid()) {
if (getEnergy() >= random(50, 99)) {
setRun(true);
}
}
//credits to alowaniak
//thanks to alowaniak
}
if(getMyPlayer().isInCombat()) {
log("Avoiding combat...");
if(getPlane() == 1) {
if(canReach(STAIRCASE_TILE, true)) {
if(!tileOnScreen(new RSTile(STAIRCASE_TILE.getX() - 1, STAIRCASE_TILE.getY()))) {
walkTileMM(STAIRCASE_TILE);
} else {
atTile(STAIRCASE_TILE, "up");
}
} else {
openDoor(getObjectAt(DOOR_CLOSE_TILE));
log("Opening door to avoid combat...");
}
return random(300, 600);
} else if(getPlane() == 2) {
if(!tileOnScreen(STAIRCASE_TILE)) {
walkTileMM(STAIRCASE_TILE);
} else {
atTile(STAIRCASE_TILE, "down");
}
return random(300, 600);
}
}
//thanks to alowaniak
//credits to alowaniak
if (getPlane() == 0 || distanceTo(new RSTile(3211, 3219)) > 20) {
deathWalk();
}
if (height == 1) { // flax level
if (flaxCount() > 0 || getMyPlayer().isInCombat()) {
if (!isInSpinningRoom()) {
if (isDoorClosed()) {
if (walkToTile(outsideDoor())) {
RSObject door = getObjectAt(DOOR_CLOSE_TILE);
if (door == null
|| door.getID() != DOOR_CLOSE_ID) {
return random(500, 600);
}
atDoor(door, "east", "Open");
return random(450, 500);
}
} else {
walkTileMM(new RSTile((3210 - random(0,1)), (3216 - random(0,3))));
}
} else {
for (int i = 0; i <= 10; i++) {
if (getMyPlayer().getAnimation() != -1) {
return random(350, 500);
} else {
wait(random(100, 150));
}
}
if (flaxCount() == 0) {
return random(350, 500);
}
if (RSInterface.getInterface(SPINNING_INTERFACE_ID)
.isValid()) {
atInterface(SPINNING_INTERFACE_ID,
BOW_STRING_CHILD_ID, "all");
return random(150, 300);
}
RSObject spinner = findObject(SPINNING_WHEEL_ID);
if (spinner == null) {
return random(350, 500);
}
if (!atObject(spinner, "Spin Spinning Wheel")) {
turnToTile(spinner.getLocation());
}
return random(350, 500);
}
} else {
if (isDoorClosed()) {
RSObject door = getObjectAt(DOOR_CLOSE_TILE);
if (door == null || door.getID() != DOOR_CLOSE_ID) {
return random(450, 500);
}
atDoor(door, "east", "Open");
return random(450, 500);
}
if (!walkToTile(staircaseTile())) {
return random(450, 500);
}
if (!atTile(STAIRCASE_TILE, "up")) {
turnToTile(STAIRCASE_TILE);
}
}
}
if (height == 2) { // bank level
if (flaxCount() > 0) {
if (!walkToTile(staircaseTile())) {
return random(350, 500);
}
if (!atTile(STAIRCASE_TILE, "down")) {
turnToTile(STAIRCASE_TILE);
}
} else {
if (!isInBank()) {
walkToTile(bankTile());
return random(350, 500);
}
if (bank.getInterface().isValid()) {
int temp = bowstringCount();
if (bank.depositAllExcept(FLAX_ID)) {
stringsBanked += temp;
moveMouse(random(38, 70), random(94, 122));
if (!getTopText().contains("flax")) {
bankFail++;
if (bankFail >= 20) {
log("Banking failed. Possibly ran out of flax!");
return -1;
}
return random(350, 500);
}
clickMouse(false);
wait(random(700,900));
if (atMenu("Withdraw-All")) {
bankFail = 0;
return random(750, 900);
}
}
return random(500, 550);
}
//LAZY **** FIX by DreaDz
RSNPC banker = getNearestNPCByID( 4907 );
if(banker != null){
atNPC(banker, "Bank Bank Tutor");
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return random(750, 800);
}
//thanks
//to
//alowaniak
public void openDoor(RSObject door) {
walkTileMM(door.getLocation());
setCameraRotation(random(40, 141));
atDoor(door, "east", "Open");
}
//credits
//to
//alowaniak
public void deathWalk() {
if (getPlane() != 0 && distanceTo(new RSTile(3206, 3208)) <= 20) {
return;
}
if (distanceTo(new RSTile(3211, 3220)) > 20) {
castSpell(1);
wait(random(6500,8000));
}
}
public void onRepaint(Graphics g) {
if (isLoggedIn() && proggy == true) {
long millis = System.currentTimeMillis() - startTime;
long seconds2 = millis / 1000;
long hours = millis / (1000 * 60 * 60);
millis -= hours * 1000 * 60 * 60;
long minutes = millis / (1000 * 60);
millis -= minutes * 1000 * 60;
long seconds = millis / 1000;
String hoursString = "";
String minutesString = "";
String secondsString = seconds + "";
String type = "seconds";
if (minutes > 0) {
minutesString = minutes + ":";
type = "minutes";
}
if (hours > 0) {
hoursString = hours + ":";
type = "hours";
}
if (minutesString.length() == 1) {
minutesString = "0" + minutesString;
}
if (hoursString.length() == 1) {
hoursString = "0" + hoursString;
}
if (secondsString.length() == 1) {
secondsString = "0" + secondsString;
}
int x = 18;
int y = 18;
g.setColor(RED);
g.drawString(
getName() + " v" + getVersion() + " by " + getAuthor(), x,
y += 20);
g.drawString("Running for " + hoursString + minutesString
+ secondsString + " " + type + ".", x, y += 20);
g.setColor(RED);
g.drawString("Spun "
+ (stringsBanked + getInventoryCount(BOW_STRING_ID))
+ " flax.", x, y += 20);
if (seconds2 != 0) {
g.drawString("Averaging "
+ (stringsBanked + getInventoryCount(BOW_STRING_ID))
* 3600 / seconds2 + " strings per hour.", x, y += 20);
}
}
}
public void serverMessageRecieved(ServerMessageEvent e) {
String message = e.getMessage().toLowerCase();
if (message.contains("You need to wait another ")
&& message.contains(" to cast this spell.")) {
int num = Integer.parseInt(message.split(" ")[5]);
logoutFor(num * 1000 * 60 * 60);
}
}
public int getAngleToCoordinates(int x2, int y2) {
int x1 = getMyPlayer().getLocation().getX();
int y1 = getMyPlayer().getLocation().getY();
int x = x1 - x2;
int y = y1 - y2;
double angle = Math.toDegrees(Math.atan2(x, y));
if (x == 0 && y > 0) {
angle = 180;
}
if (x < 0 && y == 0) {
angle = 90;
}
if (x == 0 && y < 0) {
angle = 0;
}
if (x < 0 && y == 0) {
angle = 270;
}
if (x < 0 && y > 0) {
angle += 270;
}
if (x > 0 && y > 0) {
angle += 90;
}
if (x < 0 && y < 0) {
angle = Math.abs(angle) - 180;
}
if (x > 0 && y < 0) {
angle = Math.abs(angle) + 270;
}
if (angle < 0) {
angle = 360 + angle;
}
if (angle >= 360) {
angle -= 360;
}
return (int) angle;
}
public void turnToTile(RSTile tile) {
int angle = getAngleToCoordinates(tile.getX(), tile.getY());
angle = angle + random(-20, 20);
if (angle < 0) {
angle = 360 + angle;
}
if (angle >= 360) {
angle -= 360;
}
setCameraRotation2(angle);
}
public void setCameraRotation2(int degrees) {
// Made by aftermath. Was suggested into SVN and i just added it into
// here until somebody does the right thing
char left = 37;
char right = 39;
char whichDir = left;
int start = getCameraAngle();
if (start < 180) {
start += 360;
}
if (degrees < 180) {
degrees += 360;
}
if (degrees > start) {
if (degrees - 180 < start) {
whichDir = right;
}
} else if (start > degrees) {
if (start - 180 >= degrees) {
whichDir = right;
}
}
degrees %= 360;
Bot.getInputManager().pressKey(whichDir);
int timeWaited = 0;
while (getCameraAngle() > degrees + 5 || getCameraAngle() < degrees - 5) {
wait(10);
timeWaited += 10;
if (timeWaited > 500) {
int time = timeWaited - 500;
if (time == 0) {
Bot.getInputManager().pressKey(whichDir);
} else if (time % 40 == 0) {
Bot.getInputManager().pressKey(whichDir);
}
}
}
Bot.getInputManager().releaseKey(whichDir);
}
public RSTile[] generatePath(RSTile tile) {
return generatePath(tile.getX(), tile.getY());
}
public RSTile[] generatePath(int destinationX, int destinationY) { // Most
// credits
// go to
// aftermath...
// I
// asked
// for a
// theory
// and
// he
// gives
// me
// the
// whole
// method.
// ~Mike
int startX = getMyPlayer().getLocation().getX();
int startY = getMyPlayer().getLocation().getY();
double dx, dy;
ArrayList<RSTile> list = new ArrayList<RSTile>();
list.add(new RSTile(startX, startY));
while (Math.hypot(destinationY - startY, destinationX - startX) > 8) {
dx = destinationX - startX;
dy = destinationY - startY;
int gamble = random(14, 17);
while (Math.hypot(dx, dy) > gamble) {
dx *= .95;
dy *= .95;
}
startX += (int) dx;
startY += (int) dy;
list.add(new RSTile(startX, startY));
}
list.add(new RSTile(destinationX, destinationY));
return list.toArray(new RSTile[list.size()]);
}
public String getTopText() {
return getMenuItems().get(0).toLowerCase();
}
RSTile current2 = null;
public boolean walkPathMM2(RSTile[] path, int maxDist) {
try {
RSTile next = nextTile(path, maxDist);
if (next != null && !next.equals(current2)) {
walkTileMM(next);
current2 = next;
return false;
} else if (next != null && next.equals(current2)) {
return false;
}
} catch (Exception e) {
return false;
}
return true;
}
public RSTile nextTile2(RSTile[] path, int maxDist) {
RSTile cur = getMyPlayer().getLocation();
for (int i = path.length - 1; i >= 0; i--) {
if (distanceBetween(cur, path[i]) <= maxDist) {
return path[i];
}
}
return null;
}
}
Look where it says PublicClass. Save it as what it says next to it (I think its LumbFlaxSpinner). Put .java at the end and then run the icon that says Compile. This will compile it, and make a .class, which is what RsBot will run.Sorry to be a total douche/noob, but how do I save the code into a usable script?
Sorry again and thanks for any help, I'm trying to learn how to do this![]()
Look where it says PublicClass. Save it as what it says next to it (I think its LumbFlaxSpinner). Put .java at the end and then run the icon that says Compile. This will compile it, and make a .class, which is what RsBot will run.
Read a guide for RsBot.
You wasted 10 seconds of my lifeLol thanks. I decided to read up on it and figured it out already, but thanks for your answer.
You wasted 10 seconds of my life.
Haha, no really, I'm glad you read up on it, people who don't read any of the countless guides and then ask stupid questions annoy me.