Jump to content

HeyImJamie

Lifetime Sponsor
  • Posts

    1096
  • Joined

  • Last visited

  • Feedback

    100%

Posts posted by HeyImJamie

  1. 1 hour ago, Juggles said:

    Nope that's it. 

    public void startedQuest() {

    if (configs().get(62)==3) {

    return true;

    }

    return false;

    }

    im on mobile you get the idea

    10/10 S2 ability. Goodluck returning a void method 😉

    public boolean isQuestStarted(Quest quest) {
    	return quest.getConfig() > 0;
    }
    
    public enum Quest {
    	GOBLIN_DIPLOMACY(63);
    	
    	int questConfig;
    	
    	Quest(int questConfig) {
    		this.questConfig = questConfig;
    	}
    
    	public int getConfig() {
    		return questConfig;
    	}
    }

    I'd do something like this. Store all your quests in an enum and just check the config is > 0 to check if it's started. Quests also have finished settings, so you can store those in this enum as well and add an isQuestFinished method etc. :) Hope this helps.

    • Like 1
  2. Looking for thread designs for a few of my scripts. Payment is open for discussion. I'll ideally need the layout designed w/ graphics, text etc so ideally will need someone who's creative and good w/ 'marketing' / advertisement. I'm not looking for a generic large image.

    Can't really think of how to word this to get exactly what I want across, so please pm me or add my Discord @ HeyImLit#3244 if you have any questions. :) Cheers.

  3. 32 minutes ago, Elixar said:

    WebWalk should be able to find a route... especially to Lumbridge bank that's a commonly used place that is programmed In the API so double check the code maybe?

    If not... I hear that it's better practice to program your own paths, you'll have to map each position, but I'm pretty sure if you type in on Google " OsBot  custom pathing" then Explv or someone should have a tutorial for this.

     

    The only issue is that when you're not using webWalk you will have to manually code in the handling of Stairs, Doors, whatever it may be that's in the way of your custom path.:gnome:

    Depends where you are. It's only better practice when you can guarantee you're walking from one set location to another.

  4. Just now, t0r3 said:

    Yeah u'r right ahha :D Managed to fix it :) I'll b careful to null check in the future. Ty :)

    Well done :D Next step I'd say would be to re-think your logic a little bit. For example, your bank method could be re-ordered so it checks that the bank contains the ore prior to withdrawing, rather than attempting to withdraw and then stopping script.

    • Like 1
  5. 7 minutes ago, t0r3 said:
    
    
     

    Ok, changed the script to this above, and got this NPE ;

    Error in script executor!
    java.lang.NullPointerException
        at EdgeSmelter.bronzeBars(EdgeSmelter.java:33)
        at EdgeSmelter.onLoop(EdgeSmelter.java:90)
        at org.osbot.rs07.event.ScriptExecutor$InternalExecutor.run(df:126)
        at java.lang.Thread.run(Unknown Source)

    I don't think spoonfeeding you here is going to help you much. The NPE directs you to where the error is (line 33 of your script). You're not null checking something correctly on that line, so go figure it out :D Based on looking at your code though there's a few areas where you haven't bothered to null check, so get them fixed up too and you'll be good to go!

    • Sad 1
  6. 8 minutes ago, t0r3 said:

    Happening everytime I start this script i made ; 

     

    
    public class EdgeSmelter extends Script {
    
        private Area smeltArea = new Area(3105, 3501, 3110, 3496);
    
        private void bronzeBars(){
    
            boolean gotCopperAndTinOre = getInventory().contains("Copper ore", "Tin ore");
            boolean isSmeltScreenVisible = getWidgets().get(270,14).isVisible();
            boolean inSmeltArea = smeltArea.contains(myPosition());
    
            RS2Widget bronzeBarsButton = getWidgets().get(270,14);
            RS2Object smelter = getObjects().closest("Furnace");
    
            if (gotCopperAndTinOre && !inSmeltArea){
    
                log("Walking to Smelter");
                getWalking().webWalk(smeltArea);
            }
    
            if (inSmeltArea && smelter != null) {
    
                smelter.interact("Smelt");
                SleepEasy.sleepUntil(() -> isSmeltScreenVisible, 5000);
    
                bronzeBarsButton.interact("Smelt");
                SleepEasy.sleepUntil(() -> !gotCopperAndTinOre,18000);
            }
        }
    
        private void needToBank() throws InterruptedException {
    
            boolean gotCopperAndTinOre = getInventory().contains("Copper ore", "Tin ore");
    
           if (!Banks.EDGEVILLE.contains(myPosition()) && !gotCopperAndTinOre){
    
                log("Walking to bank");
                getWalking().webWalk(Banks.EDGEVILLE);
            }
    
           if (Banks.EDGEVILLE.contains(myPosition()) && !gotCopperAndTinOre) {
    
               getBank().open();
               SleepEasy.sleepUntil(() -> getBank().isOpen(), 10000);
               log("Depositing bronze bars");
               getBank().depositAll("Bronze bar");
    
               log("Withdrawing ores");
               getBank().withdraw("Copper ore" + "Tin ore", 14);
           }
    
           if (!getBank().contains("Copper ore", "Tin ore")){
               log("Stopping script");
                   stop(false);
           }
    
        }
    
    
        @Override
        public int onLoop() throws InterruptedException{
    
            boolean gotCopperAndTinOre = getInventory().contains("Copper ore", "Tin ore");
    
            if (!gotCopperAndTinOre) {
    
                needToBank();
    
            } else {
    
                bronzeBars();
            }
    
    
            return 600;
        }
    }
    

    What did I do wrong? :o 

    Is that the entire script? and does the NPE direct you to any line?

  7. I personally use a mix between a Task and a State 'framework'

    For example, I'll have a Bank Task which contains code for banking. And in that class will be a switch statement that chances based on certain conditions, for example:

    switch (getTaskState()) {
    	case WALK_TO_BANK:
    		// walk to bank etc
    		break;
    
    	case OPEN_BANK:
    		// open bank
    		break;
    
    	// etc
    }
    
    private enum TaskState {
    	WALK_TO_BANK,
    	OPEN_BANK,
    	BANK_ETC
    }
    
    private TaskState getTaskState() {
    	if (!Bank.contains(Player)) {
    		return TaskState.WALK_TO_BANK;
    	
    	// etc
    }

     

  8. Awesome! Now I'd suggest you start looking at other things, such as better checks on the booleans available to you, and maybe neatening it even more?

    For example: You can use && to check for multiple conditions in one line!

×
×
  • Create New...