aestheticfc 0 Share Posted July 28, 2020 I can't find a way to know if my small, medium, and large pouches are filled or not. I am using a boolean variable in my script that is toggled every time my player clicks to fill them in the bank and shift clicks to empty them in the altar but it is giving me problems. I checked this thread but the Debug Tool's Player Setting does not change any values when I fill/empty pouches. On another forum some guy said "the varbits for essence storage were removed by Jagex" so I assume the aforementioned thread's information is outdated? Any way to do this? Link to comment Share on other sites More sharing options...
RetroBot 35 Share Posted July 28, 2020 Not sure if this still works, but heres something I used years ago package utils; import org.dreambot.api.script.AbstractScript; public enum Pouch { SMALL("Small pouch", 5509, -1, 1, 3, 3), MEDIUM("Medium pouch", 5510, 5511, 50, 6, 3), LARGE("Large pouch", 5512, 5513, 50, 9, 7), GIANT("Giant pouch", 5514, 5515, 75, 12, 9); public final String name; public final int normalID; public final int degradedID; public final int requiredLevel; public final int normalHold; public final int degradedHold; Pouch(String name, int AssignedNormalID, int AssignedDegradedID, int AssignedRequiredLevel, int AssignedNormalHold, int AssignedDegradedHold ) { this.name = name; this.normalID = AssignedNormalID; this.degradedID = AssignedDegradedID; this.requiredLevel = AssignedRequiredLevel; this.normalHold = AssignedNormalHold; this.degradedHold = AssignedDegradedHold; } public static EssenceType getPouchEssenceType(AbstractScript script, Pouch p) { int setting = script.getPlayerSettings().getConfig(720); switch (p) { case SMALL: return setting >= 128 ? EssenceType.PURE : (setting >= 0x40) && (setting < 0x80) ? EssenceType.NORMAL : null; case MEDIUM: if (setting >= 64) setting %= 64; return setting >= 32 ? EssenceType.PURE : (setting >= 0x10) && (setting < 0x20) ? EssenceType.NORMAL : null; case LARGE: if (setting >= 64) setting %= 64; if (setting >= 16) setting %= 16; return setting >= 9 ? EssenceType.PURE : (setting >= 0x4) && (setting < 0x9) ? EssenceType.NORMAL : null; case GIANT: if (setting >= 64) setting %= 64; if (setting >= 16) setting %= 16; if (setting >= 4) if (setting < 0x9) setting %= 0x4; else setting %= 0x9; return setting == 0x2 ? EssenceType.PURE : setting == 0x1 ? EssenceType.NORMAL : null; } return null; } public static int getEssenceCount(AbstractScript script, Pouch p) { int setting = script.getPlayerSettings().getConfig(486) - 0x40000000; switch (p) { case GIANT: return setting / 0x40000; case LARGE: setting %= 262144; return setting / 0x200; case MEDIUM: setting %= 262144; setting %= 512; return setting / 8; case SMALL: setting %= 262144; setting %= 512; return setting % 8; } return -1; } public String getName() { return name; } public int getNormalID() { return normalID; } public int getDegradedID() { return degradedID; } public int getNormalHold() { return normalHold; } public int getDegradedHold() { return degradedHold; } public int getRequiredLevel() { return requiredLevel; } public EssenceType getEssencesType(AbstractScript script) { return getPouchEssenceType(script, this); } public int getEssencesAmount(AbstractScript script) { return getEssenceCount(script, this); } public static boolean isEmpty(AbstractScript script) { // checks to see if one of the pouches in inventory are empty return script.getInventory().contains(Pouch.SMALL.getNormalID()) && !isFull(script, Pouch.SMALL) || script.getInventory().contains(Pouch.MEDIUM.getNormalID()) && !isFull(script, Pouch.MEDIUM) || script.getInventory().contains(Pouch.LARGE.getNormalID()) && !isFull(script, Pouch.LARGE) || script.getInventory().contains(Pouch.GIANT.getNormalID()) && !isFull(script, Pouch.GIANT); } public static boolean isEmpty(AbstractScript script, Pouch p) { // checks specific pouch if empty return script.getInventory().contains(p.getNormalID()) && !isFull(script, p); } public static boolean allEmpty(AbstractScript script) { if (script.getInventory().containsAll("Small pouch", "Medium pouch", "Large pouch", "Giant pouch")) { return isEmpty(script, Pouch.SMALL) && isEmpty(script, Pouch.MEDIUM) && isEmpty(script, Pouch.LARGE) && isEmpty(script, Pouch.GIANT); } else if (script.getInventory().containsAll("Small pouch", "Medium pouch", "Large pouch")) { return isEmpty(script, Pouch.SMALL) && isEmpty(script, Pouch.MEDIUM) && isEmpty(script, Pouch.LARGE); } else if (script.getInventory().containsAll("Small pouch", "Medium pouch")) { return isEmpty(script, Pouch.SMALL) && isEmpty(script, Pouch.MEDIUM); } else if (script.getInventory().containsAll("Small pouch")) { return isEmpty(script, Pouch.SMALL); } return false; } public static boolean containsRune(AbstractScript script) { return (script.getInventory().contains(Pouch.GIANT.getName()) && Pouch.getEssenceCount(script, Pouch.GIANT) > 0) || (script.getInventory().contains(Pouch.LARGE.getName()) && Pouch.getEssenceCount(script, Pouch.LARGE) > 0) || (script.getInventory().contains(Pouch.MEDIUM.getName()) && Pouch.getEssenceCount(script, Pouch.MEDIUM) > 0) || (script.getInventory().contains(Pouch.SMALL.getName()) && Pouch.getEssenceCount(script, Pouch.SMALL) > 0); } public static boolean containsRune(AbstractScript script, Pouch p) { return script.getInventory().contains(p.getName()) && Pouch.getEssenceCount(script, p) > 0; } public static boolean isFull(AbstractScript script, Pouch p) { return (script.getInventory().contains(p.getNormalID()) && Pouch.getEssenceCount(script, p) == p.getNormalHold()) || (script.getInventory().contains(p.getDegradedID()) && Pouch.getEssenceCount(script, p) == p.getDegradedHold()); } } Link to comment Share on other sites More sharing options...
Manly 879 Share Posted July 28, 2020 There is no more player setting for each pouch so you have to track manually. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.