• Log in or sign up for an account here: https://www.sythe.org/login

Smithing script at Yanille?

PG2

Forum Addict
Joined
Oct 12, 2008
Sythe Gold
0
Messages
308
Would anyone be willing to make a platebody smither in yanille, please? I prefer yanille over varrock, and I would appreciate if I could have one. thank you :)
 
Dunno why you would prefer yanille, but i don't think there is any currently made.



However i think it would be pretty simple just to change the id's of the bank and rstiles of a varrock smelter.


I will see what i can do for yah :D

EDIT: here yah go. Its fusion89k platebody smelter edited for yanille

Code:
import java.awt.Color;
import java.awt.Graphics;
import java.util.Map;

import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
import com.speljohan.rsbot.event.listeners.PaintListener;
import com.speljohan.rsbot.event.listeners.ServerMessageListener;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.RSInterface;
import com.speljohan.rsbot.script.wrappers.RSItem;
import com.speljohan.rsbot.script.wrappers.RSObject;
import com.speljohan.rsbot.script.wrappers.RSTile;

public class PlateBodySmither extends Script implements PaintListener,
		ServerMessageListener {

	private int barID, tries = 0, smithed = 0, barsNeeded = 5, counting = 0;
	private final RSTile anvilTile = new RSTile(2613, 3082),
			bankTile = new RSTile(2612, 3092), scrollClick = new RSTile(500,
					300), plateClick = new RSTile(270,280);
	private final int anvilID = 2783, hammerID = 2347, bankID = 2213;
	private boolean smithing = false, needScroll = true;
	private final long startTime = System.currentTimeMillis();
	private String doing = "Starting", barName;

	public String getName() {
		return "Platebody Smither- yanille";
	}

	public String getAuthor() {
		return "Fusion89k Yanille added by tylobedo";
	}

	public double getVersion() {
		return 1.2;
	}

	public String getScriptCategory() {
		return "Smithing";
	}

	public String getScriptDescription() {
		return "<html>\n"
				+ "<head></head>\n"
				+ "<body>\n"
				+ "<center>"
				+ "<h2>"
				+ getName()
				+ "</h2>"
				+ "</center>\n"
				+ "<b>Author:</b> "
				+ getAuthor()
				+ "<br />"
				+ "<b>Version:</b> "
				+ getVersion()
				+ "<br />"
				+ "<form>"
				+ "Bar Type: <select name=\"bar\">"
				+ "<option>Bronze<option>Iron<option>Steel<option>Mithril<option>Adamant<option>Rune"
				+ "</select></form><BR>"
				+ "Just Plates for right now<br>"
				+ "Notes: <br>* Have Hammer in inventory<br>* Have bars in first bank slot"
				+ "</form></body>\n" + "</html>";
	}

	public boolean onStart(Map<String, String> args) {
		Character type = args.get("bar").charAt(0);
		type = Character.toLowerCase(type);
		switch (type) {
		case 'b':
			barID = 2349;
			barName = "Bronze";
			break;
		case 'i':
			barID = 2351;
			barName = "Iron";
			break;
		case 's':
			barID = 2353;
			barName = "Steel";
			break;
		case 'm':
			barID = 2359;
			barName = "Mithril";
			break;
		case 'a':
			barID = 2361;
			barName = "Adamant";
			break;
		case 'r':
			barID = 2363;
			barName = "Rune";
			break;
		}
		setCameraAltitude(true);
		setCompass('w');
		Bot.getEventManager().addListener(PaintListener.class, this);
		return true;
	}

	public void onFinish() {
		Bot.getEventManager().removeListener(PaintListener.class, this);
	}

	public int loop() {
		if (!inventoryContains(hammerID)) {
			log("No Hammer");
			stopAllScripts();
		}
		if (getMyPlayer().isMoving())
			return random(700, 900);
		if (smithing && !doing.equals("Smithing"))
			doing = "Smithing";
		if (getInventoryCount(barID) < barsNeeded) {
			smithing = false;
			if (tries >= 5) {
				log("Probably out of Bars");
				stopAllScripts();
			}
			if (distanceTo(bankTile) > 3) {
				if (doing.contains("Bank")) {
					return random(100, 500);
				}
				doing = "Walking to Bank";
				walkTileMM(randomTile(bankTile));
				pause();
			}
			if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
				RSObject booth = findObject(bankID);
				if (booth == null)
					return random(700, 900);
				doing = "Banking";
				atObject(booth, "Use-Quickly");
				pause();
			}
			if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
				if (getInventoryCount() > 0) {
					doing = "Depositing";
					int[] array = getInventoryArray();
					for (int id : array) {
						if (id != hammerID && id != barID && !(id < 1)) {
							atInventoryItem(id, "Deposit-All");
							wait(200);
							array = getInventoryArray();
						}
					}
				}
				doing = "Withdrawing";
				bank.setWithdrawModeToItem();
				clickMouse(random(38, 73), random(92, 123), false);
				pause();
				atMenu("but");
				bank.close();
				tries++;
			}
		} else {
			if (smithing)
				return 100;
			tries = 0;
			if (distanceTo(anvilTile) > 4) {
				if (doing.contains("Anvil")) {
					return random(100, 500);
				}
				doing = "Walking to Anvil";
				walkTileMM(randomTile(anvilTile));
				return random(100, 900);
			}
			try {
				useItemCustom(new RSItem(barID, 1), findObject(anvilID));
				pause();
			} catch (NullPointerException e) {
				log("Couldn't find Anvil - Retrying");
				return random(700, 900);
			}
			if (RSInterface.getInterface(300).isValid()) {
				if (counting > 5) {
					counting = 0;
					needScroll = true;
				}
				if (needScroll) {
					clickMouse(randomTile(scrollClick).getX(), randomTile(
							scrollClick).getY(), true);
					wait(random(100, 300));
					needScroll = false;
				}
				clickMouse(randomTile(plateClick).getX(),
						randomTile(plateClick).getY(), false);
				counting++;
				pause();
				atMenu("All");
				smithing = true;
			} else
				return random(700, 900);
		}
		return random(700, 900);
	}

	private RSTile randomTile(RSTile tile) {
		int x = tile.getX(), y = tile.getY();
		x = random(x - 2, x + 2);
		y = random(y - 2, y + 2);
		return new RSTile(x, y);
	}

	private void pause() {
		wait(random(700, 900));
	}

	private void useItemCustom(RSItem item, RSObject obj) {
		if (getCurrentTab() != TAB_INVENTORY) {
			openTab(TAB_INVENTORY);
		}
		atInventoryItem(item.getID(), "Use");
		atObject(obj, "Anvil");
	}

	public void onRepaint(Graphics g) {
		if (isLoggedIn()) {
			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;
			String temp = barName;
			// 173 and 80 decide width and height respectively
			int topX = 515 - 190, topY = 337 - 80, x = topX + 5, y = topY + 5;
			g.setColor(new Color(0, 100, 0, 100));
			g.fill3DRect(topX, topY, 515 - topX, 337 - topY, true);
			g.setColor(Color.green);
			g.drawString("Runtime: " + hours + "h " + minutes + "min "
					+ seconds + "sec.", x, y += 15);
			g.drawString("Created: " + Integer.toString(smithed) + " " + temp
					+ " Platebodies.", x, y += 15);
			g
					.drawString("Used: " + smithed * barsNeeded + " bars.", x,
							y += 15);
			g.drawString("Status: " + doing, x, y += 15);
		}
	}

	public void serverMessageRecieved(ServerMessageEvent e) {
		String word = e.getMessage().toLowerCase();
		if (word.contains("make")) {
			smithed++;
		} else if (word.contains("advanced")) {
			smithing = false;
		} else if (word.contains("only have one")) {
			log("Only one bar left - Logging out");
			stopAllScripts();
		} else if (word.contains("welcome")) {
			needScroll = true;
			setCameraAltitude(true);
			setCompass('w');
		}
	}
}

enjoy!
 
Runescape Gamblingrunescape gambling
Back
Top