Jump to content

Need help whit a script.


carafelix

Recommended Posts

I have this script, but i can't compile it into a functional .jar file. Some one could tell me what im doing wrong or send me the script already turn into a jar. jejeje. The codes remain to you aswell. Carafelix#9384 on discord
 

package core;

import org.osbot.rs07.api.GrandExchange;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.api.map.constants.Banks;
import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Spells;
import org.osbot.rs07.api.ui.Tab;
import org.osbot.rs07.script.MethodProvider;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.api.ui.Spells.NormalSpells;
import org.osbot.rs07.utility.ConditionalSleep;

import core.Main;
import utils.Sleep;
import core.Starting;

@SuppressWarnings("unused")
public final class scriptLoop extends MethodProvider{
	
	public int beginningXP;
	public int currentXp;
	public int xpGained;
	public int bracelets;
	public int magicOld;
	long timeBegan;
	public long timeRan;
	public int mageLvl;
	public int attLvl;
	public String hiAlch;
	public String warn;
	public int numCharged;
	public int numBraces;
	public long costBraces;
	public String started;
	public static String braceletPrice;
	Area geArea = Banks.GRAND_EXCHANGE;
	
	public void addEther() throws InterruptedException {
		while (getInventory().contains("Nature rune") && getInventory().contains("Bracelet of ethereum (uncharged)")) {
			bracelets = (int) getInventory().getAmount("Bracelet of ethereum (uncharged)");
			if (getInventory().contains("Revenant ether")) {
				inventory.interact("Use", "Revenant ether");
				Sleep.sleepUntil(() -> getInventory().isItemSelected(), 5000);
				inventory.interact("Use", "Bracelet of ethereum (uncharged)");
				new ConditionalSleep(5000) {
    				@Override
    				public boolean condition() throws InterruptedException {
    					long braceletsNew = getInventory().getAmount("Bracelet of ethereum (uncharged)");
    					if (bracelets != braceletsNew) {
    						return true;
    					}
    					return false;
    				}
    			}.sleep();
    			}
			else if (!getInventory().contains("Revenant ether")) {
				getBank().open();
				Sleep.sleepUntil(() -> getBank().isOpen(), 5000);
				if (!getInventory().isFull()) {
					if (getBank().contains("Revenant ether")) {
						getBank().withdraw("Revenant ether", 1);
						getBank().close();
						Sleep.sleepUntil(() -> !getBank().isOpen(), 5000);
					}
					else {
						buyEther();
						}
					}
				else {
					getBank().depositAll();
					if (getBank().contains("Revenant ether")) {
						getBank().withdrawAll("Nature rune");
						getBank().withdraw("Revenant ether", 1);
						getBank().withdrawAll("Bracelet of ethereum (uncharged)");
						getBank().close();
						Sleep.sleepUntil(() -> (!getBank().isOpen()), 5000);
					}
					else {
						buyNats();
					}
				}
			}
		}
	}
		
	
	public void bank() throws InterruptedException {
		NPC geClerk = npcs.closest("Grand Exchange Clerk");
		getBank().open();
		Sleep.sleepUntil(() -> (getBank().isOpen()), 5000);
		getBank().depositAllExcept("Nature rune");
		if (getBank().contains("Bracelet of ethereum") || getBank().contains("Bracelet of ethereum (uncharged)")) {
			getBank().depositAllExcept("Nature rune");
			if (getBank().contains("Bracelet of ethereum")) {
				getBank().withdrawAll("Bracelet of ethereum");
				getBank().close();
				Sleep.sleepUntil(() -> (!getBank().isOpen()), 5000);
			}
			else if (getBank().contains("Revenant ether") && getBank().contains("Bracelet of ethereum (uncharged)")) {
				getBank().withdraw("Revenant ether", 1);
				getBank().withdrawAll("Bracelet of ethereum (uncharged)");
				getBank().close();
				Sleep.sleepUntil(() -> (!getBank().isOpen()), 5000);
		}
		}
		else {
			if(getBank().contains("Coins") && Main.braceletPrice != 0) {
				getBank().withdrawAll("Coins");
				getBank().close();
				Sleep.sleepUntil(() -> (!getBank().isOpen()), 5000);
				buyBracelets();
			} else {
				getBot().getScriptExecutor().stop(false);
			}
		}
	}
	
	public void buyBracelets() throws InterruptedException {
		NPC geClerk = npcs.closest("Grand Exchange Clerk");
		if(getBank().isOpen()) {
			getBank().close();
			Sleep.sleepUntil(() -> (!getBank().isOpen()), 5000);
		}
		if (geClerk != null) {
			geClerk.interact("Exchange");
			Sleep.sleepUntil(() -> (grandExchange.isOpen()), 5000);
			long numBracelet = getInventory().getAmount("Coins") / Main.braceletPrice;
			int numBracelets = (int) numBracelet;
			/* if(getGrandExchange().getStatus(GrandExchange.Box.BOX_1) == GrandExchange.Status.EMPTY){
				log("Opening ge slot 1");
				getGrandExchange().buyItems(GrandExchange.Box.BOX_1);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_2) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_2);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_3) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_3);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_4) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_4);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_5) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_5);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_6) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_6);
				sleep(random(2000,3000));
				}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_7) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_7);
				sleep(random(2000,3000));
			}
			else if(getGrandExchange().getStatus(GrandExchange.Box.BOX_8) == GrandExchange.Status.EMPTY){
				getGrandExchange().buyItems(GrandExchange.Box.BOX_8);
				sleep(random(2000,3000));
			}
			else {
				log("GE is full. Stopping script.");
				getBot().getScriptExecutor().stop(false);
			} */
			log("Buying bracelets");
			grandExchange.buyItem(21817, "Bracelet of ethereum (uncharged)", Main.braceletPrice, numBracelets);
			sleep(random(3000,4000));
			grandExchange.collect();
			grandExchange.close();
			Sleep.sleepUntil(() -> (!grandExchange.isOpen()), 5000);
			getInventory();
			getBank().open();
			Sleep.sleepUntil(() -> (getBank().isOpen()), 5000);
			getBank().depositAllExcept("Nature rune");
			if (getBank().contains("Bracelet of ethereum (uncharged)")) {
				getBank().withdraw("Revenant ether", 1);
				getBank().withdrawAll("Nature rune");
				getBank().withdrawAll("Bracelet of ethereum (uncharged)");
				getBank().close();
				Sleep.sleepUntil(() -> !getBank().isOpen(), 5000);
			}
			else { 
				getBank().close();
				getBot().getScriptExecutor().stop(false);
			}
		}
	}
	
	private void buyEther() throws InterruptedException {
	
	}
	
	private void buyNats() throws InterruptedException {
		
	}
	
	public void alch() throws InterruptedException {
		RS2Widget alchWarn = getWidgets().getWidgetContainingText("Click here to continue");
		getTabs().open(Tab.MAGIC);
		while (getInventory().contains("Nature rune") && getInventory().contains("Bracelet of ethereum")) {
			magicOld = skills.getExperience(Skill.MAGIC);
			if (getTabs().getOpen().equals(Tab.MAGIC)) {
				magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY);
			}
	    	inventory.interact("Cast", "Bracelet of ethereum");
	    	new ConditionalSleep(5000) {
				@Override
				public boolean condition() throws InterruptedException {
					long magicNew = skills.getExperience(Skill.MAGIC);
					if ((magicNew != magicOld) || (alchWarn != null && alchWarn.isVisible()) && getTabs().getOpen().equals(Tab.MAGIC)) {
						return true;
					}
					return false;
				}
			}.sleep();
			new ConditionalSleep(5000) {
				@Override
				public boolean condition() throws InterruptedException {
					if (getTabs().getOpen().equals(Tab.MAGIC)) {
						return true;
					}
					return false;
				}
			}.sleep();
	    	if (alchWarn != null && alchWarn.isVisible()) {
	    		warn = "Y";
	    		break;
	    	}
	    	if(getInventory().contains("Bracelet of ethereum") && getInventory().contains("Nature rune")) {
	    		magic.castSpell(Spells.NormalSpells.HIGH_LEVEL_ALCHEMY);
	    	}
	    	else {
	    		break;
	    	}
		}
		}

	
	public void warn() throws InterruptedException {
		sleep(10000);
		getBot().getScriptExecutor().stop(false);
	}
	
	public void logout() throws InterruptedException {
		getBank().open();
		Sleep.sleepUntil(() -> getBank().isOpen(), 5000);
		if (!getBank().contains("Nature rune")) {
			getBank().close();
			Sleep.sleepUntil(() -> !getBank().isOpen(), 5000);
			getBot().getScriptExecutor().stop(false);
		}
		else {
			getBank().depositAll();
			getBank().withdrawAll("Nature rune");
			getBank().withdraw("Revenant ether", 1);
			getBank().withdrawAll("Bracelet of ethereum (uncharged)");
		}
	}
	
	}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...