Vampyre Black Pudding for Awwww, Yeah trophy script

taltamir

Member
Farm fights againt black pudding for Awwww, Yeah trophy.
https://kol.coldfront.net/thekolwiki/index.php/Black_pudding_(monster)
https://kol.coldfront.net/thekolwiki/index.php/Awwww,_Yeah

The trophy requires you to defeat 240 black puddings (the monster). You do this by eating roughly 450 black puddings (the food) which is trash food of size 3. Every time you try to eat the food, there is a 35% chance that you will fight the monster, and a 65% chance that you will eat the food.

There is a trick with the dark gyffte path. If a vampyre tries to eat a pudding there is a 35% chance of them fighting the monster, and a 65% chance of them harmlessly being told vampyres only eat blood. So if you have 240 adventures, you can do this trophy in one day by just repeatedly attempting to eat it.

Run from gCLI via
Code:
blackpudding X
X = black puddings to fight

Or you can click on it from the dropdown scripts menu to be asked how many fights you want.
The script will repeatedly attempt to eat puddings until the quantity you specified has been reached.

part of the ttpack: https://kolmafia.us/showthread.php?25048

To install the entire pack:
Code:
svn checkout https://github.com/taltamir/ttpack/trunk/RELEASE/
To uninstall
Code:
svn delete ttpack
 
Last edited:

taltamir

Member
initial release code (here for comparison, latest version is posted on first post)
Code:
//if you run it without defining the variables for main, mafia asks you. this variable name is meant to be self explanatory


void main(int how_many_black_pudding_fights)
{
//avoid infinite loop by making sure requested fights is not higher than adv remaining
if (my_adventures() < how_many_black_pudding_fights)
    how_many_black_pudding_fights = my_adventures();
    
//only have a qty value if you are a vampyre
int qty = 0;
if (my_class() == $class[Vampyre])
    qty = how_many_black_pudding_fights;
else print("Vampyres only");


//while function to repeatedly eat black pudding and fight them.
while (qty > 0)
    {
    print("trying to fight a pudding");
    visit_url("inv_eat.php?whichitem=2338&pwd");
    string page_text = visit_url("main.php");
    if(page_text.contains_text("Combat"))
        {
        run_combat();
        qty--;
        }
    else print("no fight detected... retrying");
    }
}
====
I just realized that I forgot to include a check for stomach space, and it should infinite loop if someone tries to run the script without enough stomach space left. So I tested for it. Also added some documentations, communications with player via print. Slight code cleanup, and made it abort when enough puddings have been defeated to get the trophy.

Newest version:
Code:
/*
a script to farm black pudding fights for Awwww, Yeah trophy.


That trophy requires you to defeat 240 black puddings (the monster). You do this by eating roughly 450 black puddings (the food) which is trash food of size 3. Every time you try to eat the food, there is a 35% chance that you will fight the monster, and a 65% chance that you will eat the food.


There is a trick with the dark gyffte path. If a vampyre tries to eat a pudding there is a 35% chance of them fighting the monster, and a 65% chance of them harmlessly being told vampyres only eat blood. So if you have 240 adventures, you can do this trophy in one day by just repeatedly attempting to eat it as a vampyre.


You can either run this script from gCLI by using
pudding X
to fight X puddings


Or you can click on it from the dropdown scripts menu to be asked how many fights you want.
The script will repeatedly attempt to eat puddings until the quantity you specified has been reached.


Version History
2019-05-22 check fullness to avoid infinite loop. auto stop when 240+ black puddings defeated. more documentations and communications.
2019-05-21 initial version
*/


void main(int how_many_black_pudding_fights)
{
//if you run it without defining the variables for main, mafia asks you to input a value. this cumbersome variable name makes it self documenting.
int qty = how_many_black_pudding_fights;


//avoid infinite loop by making sure requested fights is not higher than adv remaining
if (my_adventures() < qty)
    qty = my_adventures();
    
//only do stuff if a vampyre
if (my_class() != $class[Vampyre])
    {
    qty = 0;
    print("You need to be a Vampyre for this script" , "red");
    }


//avoid infinite loop by making sure fullness is low enough to try and eat black pudding
if (my_class() == $class[Vampyre] && my_fullness() > 2)
    {
    qty = 0;
    print("Your fullness is already at " + my_fullness() + " out of 5, you need 3 empty stomach space for this script to work" , "red");
    }


//while function to repeatedly eat black pudding and fight them.
while (qty > 0)
    {
    print("trying to fight a pudding");
    visit_url("inv_eat.php?whichitem=2338&pwd");
    string page_text = visit_url("main.php");
    if(page_text.contains_text("Combat"))
        {
        run_combat();
        qty--;
        print();
        }
    else print("no fight detected... retrying");
    
    //notify when done running
    if (qty == 0)
        print("Done running Pudding script", "green");
    
    //stop the loop if you already got enough for the trophy
    if(get_property("blackPuddingsDefeated") > "239")
        {
        qty = 0;
        print("You have defeated enough Black Puddings to recieve the trophy", "green");
        }
    }
}
 
Last edited:

taltamir

Member
Your class and fullness checks don't actually stop the script from trying to eat puddings. You probably want exit; for that.
They do prevent pudding consumption. They set qty to 0. pudding is only consumed while qty is bigger than 0.
Therefore setting qty to zero will skip the while function for pudding consumption, reaching the end of the script, which stops running once it has been fully executed.

It isn't even expensive to do so, it just adds 1 single extra if check (the check whether qty is bigger than 0), 2 checks if you are not a vampyre.
This allows multiple error checks to runs to report multiple errors (eg, if you are not a vampyre and too full)...
which in retrospect is utterly pointless (also I ended up having fullness only be checked for vampyres anyways)
So yea, switching to exit would save between 1 to 2 if checks for someone who is trying to run the script when not a vampyre/too full.

alright, updated
Code:
/*
a script to farm black pudding fights for Awwww, Yeah trophy.


That trophy requires you to defeat 240 black puddings (the monster). You do this by eating roughly 450 black puddings (the food) which is trash food of size 3. Every time you try to eat the food, there is a 35% chance that you will fight the monster, and a 65% chance that you will eat the food.


There is a trick with the dark gyffte path. If a vampyre tries to eat a pudding there is a 35% chance of them fighting the monster, and a 65% chance of them harmlessly being told vampyres only eat blood. So if you have 240 adventures, you can do this trophy in one day by just repeatedly attempting to eat it as a vampyre.


You can either run this script from gCLI by using
pudding X
to fight X puddings


Or you can click on it from the dropdown scripts menu to be asked how many fights you want.
The script will repeatedly attempt to eat puddings until the quantity you specified has been reached.


Version History
2019-05-22b if too full/not a vampyre use exit instead of setting qty to 0. Which saves 1 or 2 if checks.
2019-05-22 check fullness to avoid infinite loop. auto stop when 240+ black puddings defeated. more documentations and communications.
2019-05-21 initial version
*/


void main(int how_many_black_pudding_fights)
{
//if you run it without defining the variables for main, mafia asks you to input a value. this cumbersome variable name makes it self documenting.
int qty = how_many_black_pudding_fights;


//avoid infinite loop by making sure requested fights is not higher than adv remaining
if (my_adventures() < qty)
    qty = my_adventures();
    
//only do stuff if a vampyre
if (my_class() != $class[Vampyre])
    {
    print("You need to be a Vampyre for this script" , "red");
    exit;
    }


//avoid infinite loop by making sure fullness is low enough to try and eat black pudding
if (my_class() == $class[Vampyre] && my_fullness() > 2)
    {
    print("Your fullness is already at " + my_fullness() + " out of 5, you need 3 empty stomach space for this script to work" , "red");
    exit;
    }


//while function to repeatedly eat black pudding and fight them.
while (qty > 0)
    {
    print("trying to fight a pudding");
    visit_url("inv_eat.php?whichitem=2338&pwd");
    string page_text = visit_url("main.php");
    if(page_text.contains_text("Combat"))
        {
        run_combat();
        qty--;
        print();
        }
    else print("no fight detected... retrying");
    
    //notify when done running
    if (qty == 0)
        print("Done running Pudding script", "green");
    
    //stop the loop if you already got enough for the trophy
    if(get_property("blackPuddingsDefeated") > "239")
        {
        qty = 0;
        print("You have defeated enough Black Puddings to recieve the trophy", "green");
        }
    }
}
 
Top