How do I find the url for purchasing goodie-bags?

ereinion

Member
So I was making a small script for buying new goodie bags for the clan, if the current amount is 0. I've come up with how to determine if there are goodie bags in the war room, but upon trying to use the mini-browser to determine what the url for purchasing a new once, I had little luck as it seems it is not able to process the button press. Is there any other simple way to determine what the url is? And have any of you got any suggestions on improvements for my pattern? I am just doing a (more or less) raw text match as you can see.
PHP:
void main() {
    buffer warroom = visit_url("clan_war.php");
    string pattern = "Bags of Goodies:<\\/td><td align=left><b>(\\d+?)<\\/b><\\/td><\\/tr>";
    matcher goodie_bags = create_matcher(pattern, warroom);
    
    if (find(goodie_bags)) {
        if (group(goodie_bags, 1) == 0) {
            // Get new goodiebag 
        }
    }
}
 
Last edited:

Darzil

Developer
An easy way is to ensure you have "verbosely log communication between KoLmafia and browser" on, then switch on debug log, do it, switch off debug log and then see what was used in the debug log.
 

ereinion

Member
Thanks!

Finished script, in case someone else should be interested in something like this:
PHP:
void main() {
    buffer warroom = visit_url("clan_war.php");
    string pattern = "Bags of Goodies:<\\/td><td align=left><b>(\\d+?)<\\/b><\\/td><\\/tr>";
    matcher goodie_bags = create_matcher(pattern, warroom);
    
    if (find(goodie_bags)) {
        print("test");
        if (group(goodie_bags, 1) == 0) {
            // Get new goodiebag 
            print("No goodie bags left, purchasing goodie bag.", "green");
            visit_url("clan_war.php?action=Yep.&goodies=1&oatmeal=&cinderblocks=&grunts=&flyers=&recliners=&archers=");
        }
    }
}
 
Top