Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • My script won't run


    Kocke

    Recommended Posts

    Posted

    Hello

     

    I need some help with my script, when I try to run it gives me some error.

    I can't figure out what it causing it.

    Can someone help me?

    @ScriptManifest(category = Category.SMITHING, name = "Kmelter", author = "Kocke", version = 1.0)
    public abstract class main extends AbstractScript{
    	
    	Area SMELT = new Area(3272, 3182, 3280, 3189);
        Area BANK = new Area(3268, 3171, 3271, 3161);
        int bar = 0;
            public int onLoop() {
            	if(getInventory().contains("Iron ore")) //Smelt
            	{
            		if(SMELT.contains(getLocalPlayer())) {
            		GameObject Smel =	getGameObjects().closest("Furnce");
            		if(Smel != null) {
            			Smel.interact("Smelt");
            			if(sleepUntil(() -> getWidgets().getWidget(270).isVisible(), 8000)) {
            				if(getWidgets().getWidget(270).getChild(16).interact("Smelt")) {
            					
            					if(sleepUntil(() -> !getInventory().contains("Iron ore"), 8000)){
            						
            					}
            				}
            			
            			}
            		}
            		}
            	}else {
            		if(getWalking().walk(SMELT.getRandomTile())){
                        sleep(Calculations.random(3000, 5500));
                    }
            	}
            	if(!getInventory().contains("Iron ore")) //Bank
            	{
            		if(BANK.contains(getLocalPlayer())) {
            			if(getBank().isOpen()) {
            				if(getBank().depositAllItems()) {
            					if(sleepUntil(() -> getInventory().isEmpty(), 3000)) {
            						if(getBank().contains("Iron ore")) {
            							
            						if(getBank().withdrawAll("Iron ore")) {
            							if(sleepUntil(() -> getInventory().contains("Iron ore"), 8000)){
                    						
                    					}
            							
            						}
            						} else {
            							return -1;
            						}
            						       						
            					}
            				}
            			}else {
            			if(getBank().openClosest()) {
            				
            			}}
            		}else {if(getWalking().walk(BANK.getRandomTile())){ //move to bank
                        sleep(Calculations.random(3000, 5500));}
            		
            	}
            	}
            	return 800;
            }
        

     

    Posted

    The error you're getting most likely tells what causes it, so paste the error line here.

    Posted

    Rewrote the script and it works now, the error I was getting was because some of the imports did not work.

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.