Jump to content

Bobrocket

Members
  • Posts

    1664
  • Joined

  • Last visited

  • Days Won

    4
  • Feedback

    100%

Posts posted by Bobrocket

  1. Im still not 100% sure if it would impact ban rates in any way sad.png

     

    The concept is indeed good, I cover something similar in a thread back eons ago.

    The execution is a bit off, however, as you can still perfectly model to a sine curve. If you add some randomness, noise etc (as well as distributional statistics!) it will look a lot more realistic as you can have a "curve of best fit" as it were just like a human.

    • Like 1
  2. public LinkedList<String> getDepositExceptions() {
    		LinkedList<String> neededItems = new LinkedList<String>();
    		if (Config.enableAttPot){
    			neededItems.add("Attack potion(4)");
    		}
    		if (Config.enableStrPot){
    			neededItems.add("Strength potion(4)");
    		}
    		if (Config.enableSupAttPot){
    			neededItems.add("Super attack(4)");
    		}
    		if (Config.enableSupStrPot){
    			neededItems.add("Super strength(4)");
    		}
    		if (Config.enableCombatPot){
    			neededItems.add("Combat potion(4)");
    		}
    		neededItems.add("Lobster");
    		return neededItems;
    	}
    

    This can be optimised in many ways. Running this is going to be more expensive than something like this:

    public enum Supplies {
        LOBSTER("Lobster", 15),
        ATTACK_POT("Attack potion(4)", 1),
        ;
    
        private String name;
        private int amt;
    
        Supplies(String name, int amt) {
            this.name = name;
            this.amt = amt;
        }
    
        public int getAmount() { return amt; }
        public String getName() { return name; }
    }
    
    //on start
    
    private List<Supplies> supplyList = new ArrayList<>();
    
    if (Config.isAttackEnabled) supplyList.add(Supplies.ATTACK_POT);
    //...
    

    Then you can do something like:

    //bank
    for (Item item : getInventory().getItems()) {
        for (Supplies supply : supplyList) if (!supply.getName().equalsIgnoreCase(item.getName())) item.interact("Deposit-All");
    }
    

    You could have a functional interface in your enum and have a static populate(Script) method, kinda looking like:

    public interface Functional<T> { public boolean perform(T param); }
    
    //enum
    LOBSTER("Lobster", 15, (script) -> true),
    ATTACK_POT("Attack potion(4)", 1, (script) -> Config.isAttackEnabled),
    COINS("Coins", 10, (script) -> script.getInventory().getAmount("Coins") < 10), //al kharid gate?
    ;
    
    private String name;
    private int amt;
    private Functional<Script> condition;
    
    public Functional<Script> getCondition() { return condition; }
    
    public static List<Supplies> populate(Script instance) {
        List<Supplies> vals = new ArrayList<>();
        for (Supplies supply : values()) if (supply.getCondition().perform(instance)) vals.add(supply);
        return vals;
    }
    
    List<Supplies> supplyList = Supplies.populate(this);

    Obviously, running these conditions at the start would mean that they wouldn't run again (unless you did populate(Script) again), but it's a nice little way to try and keep things a little organised.

    • Like 1
  3. This is not correct though, as the distance between two positions is not the same as walking distance.

    Therefore it can easily return a bank that is further away, as it is closer, but the route is longer.

     

    Also if you are in a dungeon it will return an incorrect bank due to the way the map is laid out.

     

    Correct. This is the use of a heuristic.

    To know the actual lengths, you'd need to pathfind every node. However, a heuristic uses a lot less resources and is typically accurate. (In the case of OSRS, can be very very bad due to dungeon layout like you said)

    • Like 1
×
×
  • Create New...