Jump to content

>C< Prayer potion drinker


Recommended Posts

Posted (edited)

>C< Prayer potion drinker

4EG1pKu.png

 

Basic script that drinks prayer potions when prayer points have reached desired prayer point to re-pot at.

Script will prioritise lower doses first. (E.g: Will drink a potion with 1 dose before a potion with 3 doses). 

If inventory contains no doses of prayer potion it will stop.

Also supports an option to drink Super restores instead!

 

Download:

http://www.mediafire.com/file/gdcmv404p9k1drc/Castro - Prayer potion drinker v0.3.jar

 

Source:

https://pastebin.com/VT4V6iDx

 

 

Older versions:

 

Old downloads:

Old sources:

 

Edited by Castro_
Added an option for Super restores
  • Like 2
Posted

nice, personally i use randomised prayer drinking values like below but nice release:

if (getSkills().getDynamic(PRAYER) < prayerValue) {
    pray();//pray
}
public void pray() {
    Filter<Item> prayPotionFilter = item -> item.getName().contains("Prayer");
    Item prayPotion = getInventory().getItem(prayPotionFilter);
    int a = getSkills().getDynamic(PRAYER);
    if (prayPotion.interact("Drink")) { //attack
        new ConditionalSleep(3000, 300) { //sleep for 3 seconds or until the condition is true
            @Override
            public boolean condition() throws InterruptedException {
                return getSkills().getDynamic(PRAYER) > a;
            }
        }.sleep();
    }
    prayerValue = random((int)(getSkills().getStatic(PRAYER) *0.2), (int)(getSkills().getStatic(PRAYER) *0.7));
}
Posted
Just now, scriptersteve said:

nice, personally i use randomised prayer drinking values like below but nice release:


if (getSkills().getDynamic(PRAYER) < prayerValue) {
    pray();//pray
}

public void pray() {
    Filter<Item> prayPotionFilter = item -> item.getName().contains("Prayer");
    Item prayPotion = getInventory().getItem(prayPotionFilter);
    int a = getSkills().getDynamic(PRAYER);
    if (prayPotion.interact("Drink")) { //attack
        new ConditionalSleep(3000, 300) { //sleep for 3 seconds or until the condition is true
            @Override
            public boolean condition() throws InterruptedException {
                return getSkills().getDynamic(PRAYER) > a;
            }
        }.sleep();
    }
    prayerValue = random((int)(getSkills().getStatic(PRAYER) *0.2), (int)(getSkills().getStatic(PRAYER) *0.7));
}

Thank you! and I was thinking about adding randomisation, I may do in the future :P

Posted

Your logic for selecting which pot to drink could be simplified:

Optional<Item> prayerPotion = Arrays.stream(getInventory().getItems())
	.filter(item -> item != null && item.getName().startsWith("Prayer potion"))
	.min(Comparator.comparing(Item::getName));

if (prayerPotion.isPresent()) {
    Item pot = prayerPotion.get();
}

 

Posted
17 minutes ago, jonny1179 said:

Your logic for selecting which pot to drink could be simplified:


Optional<Item> prayerPotion = Arrays.stream(getInventory().getItems())
	.filter(item -> item != null && item.getName().startsWith("Prayer potion"))
	.min(Comparator.comparing(Item::getName));

if (prayerPotion.isPresent()) {
    Item pot = prayerPotion.get();
}

 

 

Does that get the first item starting with Prayer potion? ty

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...