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
  • Try asking for help in the chatbox
  • help switching glory


    st1nklr
     Share

    Recommended Posts

    ive been trying to develop my first script but ive been struggling with this problem for the past 1 or 2 days where i cant figure out how the hell to make it so when the glory runs out of charges the bot will go to the nearest bank and switch it for a fully charged one

    Any help is appreciated im desperate at this point

    Link to comment
    Share on other sites

    You can add this lambda to your onStart (above your onLoop) and interact with the charged glories this way.

     

    public static final Filter<Item> GLORY_FILTER = Item -> Item != null && item.getname().contains("Amulet of glory (");

    So basically if you want to wear the glory or teleport or w/e you'll interact with the GLORY_FILTER.

    When your equipment contains an uncharged amulet of glory you want to unequip it. Ex:

    if(getEquipment).contains("Amulet of glory"){

    getEquipment.interact("Amulet of glory", "unEquip");

    The reason we use string "Amulet of glory"  instead of the filter is because the glory no longer contains charges.

    So lastly, if your inventory contains a glory, you will now want to go to the bank.

    So if the bank is open and your inventory contains an uncharged glory - deposit it.

    If the bank is open and your equipment || (OR) inventory does not contain GLORY_FILTER, withdraw GLORY_FILTER or just withdraw an "Amulet of glory (6)".

     

    Hopefully this will give you a better idea of what you need to do. You'll want to add in a null check for the uncharged glory as well. This is probably NOT in the right format either, you'll have to figure out how to make it work :P

    Edited by AsBakedAsCake
    Link to comment
    Share on other sites

    Maybe something like this could work?

    if (!getEquipment().contains(amulet -> amulet.getName().contains("Amulet of glory("))) {
    	getBank().withdraw("Amulet of glory(6)", 1);
    	sleep(randomNum(500,1000));
    	getInventory().interact("Amulet of glory(6)","Wear");
    }

    This obviously does not include the part where you walk to the bank and open it but the IF statement is really all you need.

    I would do the whole thing as a state/ case maybe,

    case GETNEWAMULETOFGLORYPLSS:
    
    	TP to bank location
    
    	walk to bank
    
    	interact with bank
    
    	get new amulet of glory :)
    
    	break;
    
    ------
    
    if (!getEquipment().contains(amulet -> amulet.getName().contains("Amulet of glory("))) {
    	state = State.GETNEWAMULETOFGLORYPLSS;
    }

    I havent tested any of this, am on a shitty laptop rn so excuse me if its not perfect 😛

    Link to comment
    Share on other sites

    1 hour ago, Lyuda said:

    Maybe something like this could work?

    if (!getEquipment().contains(amulet -> amulet.getName().contains("Amulet of glory("))) {
    	getBank().withdraw("Amulet of glory(6)", 1);
    	sleep(randomNum(500,1000));
    	getInventory().interact("Amulet of glory(6)","Wear");
    }

    This obviously does not include the part where you walk to the bank and open it but the IF statement is really all you need.

    I would do the whole thing as a state/ case maybe,

    case GETNEWAMULETOFGLORYPLSS:
    
    	TP to bank location
    
    	walk to bank
    
    	interact with bank
    
    	get new amulet of glory :)
    
    	break;
    
    ------
    
    if (!getEquipment().contains(amulet -> amulet.getName().contains("Amulet of glory("))) {
    	state = State.GETNEWAMULETOFGLORYPLSS;
    }

    I havent tested any of this, am on a shitty laptop rn so excuse me if its not perfect 😛

     

    11 hours ago, AsBakedAsCake said:

    You can add this lambda to your onStart (above your onLoop) and interact with the charged glories this way.

     

    public static final Filter<Item> GLORY_FILTER = Item -> Item != null && item.getname().contains("Amulet of glory (");

    So basically if you want to wear the glory or teleport or w/e you'll interact with the GLORY_FILTER.

    When your equipment contains an uncharged amulet of glory you want to unequip it. Ex:

    if(getEquipment).contains("Amulet of glory"){

    getEquipment.interact("Amulet of glory", "unEquip");

    The reason we use string "Amulet of glory"  instead of the filter is because the glory no longer contains charges.

    So lastly, if your inventory contains a glory, you will now want to go to the bank.

    So if the bank is open and your inventory contains an uncharged glory - deposit it.

    If the bank is open and your equipment || (OR) inventory does not contain GLORY_FILTER, withdraw GLORY_FILTER or just withdraw an "Amulet of glory (6)".

     

    Hopefully this will give you a better idea of what you need to do. You'll want to add in a null check for the uncharged glory as well. This is probably NOT in the right format either, you'll have to figure out how to make it work :P

    Both of these worked thank you so much! some polishing and ill be able to release my first script!

    Link to comment
    Share on other sites

    58 minutes ago, st1nklr said:

     

    Both of these worked thank you so much! some polishing and ill be able to release my first script!

    Im looking forward to it :)

    Link to comment
    Share on other sites

    3 hours ago, st1nklr said:

     

    Both of these worked thank you so much! some polishing and ill be able to release my first script!

    Glad we were able to help you out!

    Happy scripting friend! :)

    Link to comment
    Share on other sites

    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now
     Share

    ×
    ×
    • 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.