aqualectrix
Member
I'm looking for a way to check access to the Desert Beach in ASH. ashref doesn't seem to give me a handy function, although I may have missed something, so I've attempted to write my own.
There are two situations where you have access to the Beach: you have a meatcar, or you've completed the meatcar quest. (Or both, but, y'know...)
This definitely works if you've finished the quest; I've got no meatcar-only characters to test on, but I see no reason it shouldn't work there too.
Questions:
1. Have I missed some built-in or simpler way to do this? I can code, but ASH and KolMafia are fairly new to me.
2. If you try to go to the beach without having the quest completed, and without the meatcar, but with all the meatcar parts (i.e. creatable_amount() == 1), does Mafia auto-make the meatcar?
2a. If not, should I just use retrieve_item() instead, to make the meatcar if you can? Are there ever reasons you have the parts and want to get to the beach, but don't want to make the car? It seems unlikely.
3. This function as written hits the quest log every time you call it if you haven't got a meat car. Very Bad Thing, especially since it's unnecessary. Ideally, once it found that the quest had been completed, it would set some boolean ("beach") to true and add an if(beach) return true; to the start of the function. This variable would ideally persist across multiple runnings of the script (although I suppose one page hit per script call wouldn't be too bad) -- would a zlib variable be appropriate? It looks like updatevars() might have to be used to update the value from the script in that case.
There are two situations where you have access to the Beach: you have a meatcar, or you've completed the meatcar quest. (Or both, but, y'know...)
Code:
boolean gotBeach()
{
# Perhaps you have a meatcar?
if (item_amount($item["bitchin' meatcar"]) > 0)
return true;
# Or have finished the meatcar quest?
if ((visit_url("questlog.php?which=2")).contains_text("My Other Car Is Made of Meat"))
return true;
return false;
}
This definitely works if you've finished the quest; I've got no meatcar-only characters to test on, but I see no reason it shouldn't work there too.
Questions:
1. Have I missed some built-in or simpler way to do this? I can code, but ASH and KolMafia are fairly new to me.
2. If you try to go to the beach without having the quest completed, and without the meatcar, but with all the meatcar parts (i.e. creatable_amount() == 1), does Mafia auto-make the meatcar?
2a. If not, should I just use retrieve_item() instead, to make the meatcar if you can? Are there ever reasons you have the parts and want to get to the beach, but don't want to make the car? It seems unlikely.
3. This function as written hits the quest log every time you call it if you haven't got a meat car. Very Bad Thing, especially since it's unnecessary. Ideally, once it found that the quest had been completed, it would set some boolean ("beach") to true and add an if(beach) return true; to the start of the function. This variable would ideally persist across multiple runnings of the script (although I suppose one page hit per script call wouldn't be too bad) -- would a zlib variable be appropriate? It looks like updatevars() might have to be used to update the value from the script in that case.