Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Beginner] Progressive Wc-script, getAxes() method design questions

Featured Replies

Hey :)

1)

Better to have 

getBank().depositAll(axes)

in

if (canGetSteelAxe && axeInBank) {}

or in

boolean axeInBank = getBank().contains(axes -> axes.getName().endsWith("axe")) && getBank().depositAll(axes);

like I already do?

Thinking having it in each of the if's would require less from the cpu, rather than calling it every single time I'm using my getAxes() method?

EDIT: Had to change things up, so that bot wouldn't withdraw and deposit axe every single time before proceeding.

2)

Would it be better to include ex. 

getBank().withdraw("Steel axe", 1);

 in 

boolean canGetSteelAxe = (wcLvl > 6 && wcLvl < 21) && getBank().contains(axes);

, and just leave it with 

getBank().depositAll(axes);
log("Withdrawing Steel axe");

 ? :)

 

...Sorry if the question is confusing hahah.

 

getAxes() code :

private void getAxes() {

     int wcLvl = getSkills().getStatic(Skill.WOODCUTTING);

     boolean canGetSteelAxe = (wcLvl > 6 && wcLvl < 21) && getBank().contains(axes) && !getInventory().contains("Steel axe");
     boolean canGetMithrilAxe = (wcLvl >= 21 && wcLvl < 31) && getBank().contains(axes) && !getInventory().contains("Mithril axe");
     boolean canGetAdamantAxe = (wcLvl >= 31 && wcLvl < 41) && getBank().contains(axes) && !getInventory().contains("Adamant axe");
     boolean canGetRuneAxe = wcLvl >= 41 && getBank().contains(axes) && !getInventory().contains("Rune axe");

    boolean axeInBank = getBank().contains(axes -> axes.getName().endsWith("axe"));

    if (canGetSteelAxe && axeInBank) {

        getBank().depositAll(axes);
        log("Withdrawing Steel axe");
        getBank().withdraw("Steel axe", 1);
    }

    if (canGetMithrilAxe && axeInBank) {

        getBank().depositAll(axes);
        log("Withdrawing Mithril axe");
        getBank().withdraw("Mithril axe", 1);
    }

    if (canGetAdamantAxe && axeInBank) {

        getBank().depositAll(axes);
        log("Withdrawing Adamant axe");
        getBank().withdraw("Adamant axe", 1);
    }

    if (canGetRuneAxe && axeInBank) {

        getBank().depositAll(axes);
        log("Withdrawing Rune axe");
        getBank().withdraw("Rune axe", 1);
    }
}

Edited by t0r3

  • Author
7 minutes ago, Imthabawse said:

Why no black axe!? ?‍♂️ 

hahah :D No one use black axe ? Got any suggestions though? : )

3 minutes ago, t0r3 said:

hahah :D No one use black axe ? Got any suggestions though? : )

I do.. ? lol but on a serious note as I said before I personally have not used booleans so I would write something like:

If (wcLvl > 21 && wcLvl < 31) {

getWalking.webWalk(bank)

getbank.open

deposit steelaxe

withdraw mithrilaxe

Wrote on phone so yeah.. 

  • Author
13 minutes ago, Imthabawse said:

I do.. ? lol but on a serious note as I said before I personally have not used booleans so I would write something like:

If (wcLvl > 21 && wcLvl < 31) {

getWalking.webWalk(bank)

getbank.open

deposit steelaxe

withdraw mithrilaxe

Wrote on phone so yeah.. 

Yeah that would work I think, but I don't want to do that in the middle of cutting wood. Wanna wait till banking :)

15 minutes ago, HeyImJamie said:

I'd suggest looking at Enums. :)

Thanks! Any examples, and in relation what? :D

  • Author
8 minutes ago, Imthabawse said:

@t0r3 in that case you could add to if (wcLvl > 21 && wcLvl < 31 && getInventory.isFull) {

walk.bank

Etc..

I have this in my banking method :) Might have to change some stuff tho

private void needToBank() throws InterruptedException {

    boolean axeInInventory = getInventory().contains(axes -> axes.getName().endsWith("axe"));

    if (!Banks.LUMBRIDGE_UPPER.contains(myPosition())) {

        getWalking().webWalk(Banks.LUMBRIDGE_UPPER);

    }  if (getInventory().isEmpty() || !axeInInventory){

        getBank().open();

        SleepEasy.sleepUntil(() -> getBank().isOpen(), 18000);

        if (getBank().contains(axes)) {

            getAxes();
        }
    }

    if (getInventory().isFull()) {

        getBank().open();

        SleepEasy.sleepUntil(() -> getBank().isOpen(), 14000);

        if (getBank().isOpen() && getInventory().contains(logs -> logs.getName().endsWith("logs"))) {

            getBank().depositAllExcept(axes);
        }

        if (getBank().contains(axes)) {

            getAxes();
        }
    }
}

Edited by t0r3

Wouldnt it try to keep getting an axe out of the bank after wcLvl >= 41 "Rune axe"? Have you tested this?

  • Author
8 minutes ago, Imthabawse said:

Wouldnt it try to keep getting an axe out of the bank after wcLvl >= 41 "Rune axe"? Have you tested this?

Yeah maybe. No, haven't tested it. But when using the other axes, it already has the desired axe in inventory and is not stuck trying to withdraw/deposit other axes. So guess that it still would work. Could set it to == 41 probably idk :o u making a progressive script too? hehe

EDIT: yes, it got stuck lol. 

changed it to ;

boolean canGetMithrilAxe = (wcLvl >= 21 && wcLvl < 31) && getBank().contains(axes);
boolean canGetAdamantAxe = (wcLvl >= 31 && wcLvl < 41) && getBank().contains(axes);

Edited by t0r3

Actually id use that to get all axes.. ex:

If(wcLvl == 21) {

get Mithril axe 

And no i'm not making a progressive script I just write scripts for tasks I dont wanna do lol

  • Author
2 minutes ago, Imthabawse said:

Actually id use that to get all axes.. ex:

If(wcLvl == 21) {

get Mithril axe 

And no i'm not making a progressive script I just write scripts for tasks I dont wanna do lol

Yeah, but what if the script starts at lvl 24 and has a steel axe equipped? Then it would not withdraw another axe before reaching lvl 31? :D

  • Author
14 minutes ago, Imthabawse said:

Yeah true guess thatd only be good from lvl 1 ?

yeah ?  

Discovered it would always deposit the current axe before withdrawing it again, each time banking. Changed it to;

boolean canGetSteelAxe = (wcLvl > 6 && wcLvl < 21) && getBank().contains(axes) && !getInventory().contains("Steel axe");

so that it will only get the steel axe when it is not in inventory :)

Also moved 

getBank().depositAll(axes);

out of

boolean axeInBank

into

if (canGetSteelAxe && axeInBank)

aaand now it works :) lol, always something wrong

Changed it in the OP too.

 

Edited by t0r3

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.