st1nklr 1 Share Posted April 26, 2020 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 More sharing options...
AsBakedAsCake 203 Share Posted April 26, 2020 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 Link to comment Share on other sites More sharing options...
Lyuda 10 Share Posted April 26, 2020 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 More sharing options...
st1nklr 1 Author Share Posted April 26, 2020 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 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 More sharing options...
Lyuda 10 Share Posted April 26, 2020 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 More sharing options...
AsBakedAsCake 203 Share Posted April 26, 2020 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.