ymirwork Posted August 5, 2023 Share Posted August 5, 2023 Hi i create myself Script but when i build jar and "Start local" Script does not run can anyone help me solve this? What am I doing wrong? package me.ywsmithing; import org.osbot.rs07.api.Bank; 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.model.RS2Object; import org.osbot.rs07.api.ui.RS2Widget; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; import java.awt.*; @ScriptManifest(name = "YW_Smithing", info = "Smithing from Ore to Bars", author = "YmirWork", version = 0.1, logo = "") public class Main extends Script{ private Area smeltingArea = new Area(3105, 3501, 3110, 3496), bankArea = Banks.EDGEVILLE, exchangeArea = Banks.GRAND_EXCHANGE; // Area(3160, 3484, 3169, 3494); NPC bank = getNpcs().closest("Banker"); NPC clerk = getNpcs().closest("Grand Exchange Clerk"); long coins = 100; int silverBarsSell = 75; int silverOre = 28; @Override public void onStart() throws InterruptedException { log("Starting Script"); } @Override public int onLoop() throws InterruptedException { walkToBankArea(); openBank(); withdrawItems(); smelting(); bankDeposit(); return random(1200 , 1800); } public void bankDeposit() { if (inventory.getAmount("Silver Bar") == 14 && !inventory.contains("Silver Ore") && bankArea.contains(myPosition()) && bank != null && getBank().isOpen()) { log("Deposit Silver Bar"); getBank().depositAll("Silver Bar"); new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return !inventory.contains("Silver Bar"); } }.sleep(); } } public void walkToBankArea(){ if(inventory.isEmpty() || inventory.getAmount("Silver Bar") == 14 && !bankArea.contains(myPosition())){ log("Walking to Bank Area"); getWalking().webWalk(bankArea); new ConditionalSleep(2000){ @Override public boolean condition() throws InterruptedException{ return bankArea.contains(myPosition()); } }.sleep(); } else if (bankArea.contains(myPosition()) && bank != null && !bank.isVisible() ) { getCamera().toEntity(bank); } } public void withdrawItems() { if(inventory.isEmpty() && bankArea.contains(myPlayer()) && bank != null && getBank().isOpen()) { log("Withdraw Silver Ore"); getBank().withdrawAll("Silver Ore"); new ConditionalSleep(3000) { @Override public boolean condition() throws InterruptedException { return inventory.contains("Silver Ore"); } }.sleep(); } } public void openBank(){ if ((inventory.isEmpty() || (inventory.getAmount("Silver bar") == 14) && bankArea.contains(myPlayer()) && bank != null && bank.isVisible() && !getBank().isOpen())){ log("Open Bank"); bank.interact("Bank"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getBank().isOpen(); } }.sleep(); } } public void smelting() { RS2Object furnace = getObjects().closest("Furnace"); RS2Widget silverWidget = getWidgets().get(270, 17, 29); if(inventory.contains("Silver Ore") && !smeltingArea.contains(myPlayer())) { log("Walking to Smealting Area"); getWalking().webWalk(smeltingArea); new ConditionalSleep(30000) { @Override public boolean condition() throws InterruptedException { return smeltingArea.contains(myPlayer()); } }.sleep(); } else if (smeltingArea.contains(myPlayer()) && furnace != null && !furnace.isVisible()) { getCamera().toEntity(furnace); } if(inventory.contains("Silver Ore") && smeltingArea.contains(myPlayer()) && furnace != null && silverWidget == null && !myPlayer().isAnimating() && furnace.isVisible()) { log("Start Smelting "); furnace.interact("Smelt"); new ConditionalSleep(5000) { @Override public boolean condition() throws InterruptedException { return getDialogues().isPendingContinuation() || silverWidget != null; } }.sleep(); }else if (inventory.contains("Silver Ore") && smeltingArea.contains(myPlayer()) && !myPlayer().isAnimating() && silverWidget != null) { silverWidget.interact(); new ConditionalSleep(60000) { @Override public boolean condition() throws InterruptedException { return !inventory.contains("Silver Ore") || getDialogues().isPendingContinuation(); } }.sleep(); } } @Override public void onExit() throws InterruptedException { log("Stopping Script."); } @Override public void onPaint(Graphics2D g) { } } 1 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted August 5, 2023 Share Posted August 5, 2023 You can't do this there, you have to do this in your onLoop: NPC bank = getNpcs().closest("Banker"); NPC clerk = getNpcs().closest("Grand Exchange Clerk"); 1 1 Quote Link to comment Share on other sites More sharing options...
ymirwork Posted August 5, 2023 Author Share Posted August 5, 2023 44 minutes ago, Khaleesi said: You can't do this there, you have to do this in your onLoop: NPC bank = getNpcs().closest("Banker"); NPC clerk = getNpcs().closest("Grand Exchange Clerk"); Ohh.... Thats right Thanks ! Close topic 1 Quote Link to comment Share on other sites More sharing options...