Fortune Cookie Counterscript

At a guess you ought to replace cube of billiard chalk with $item[cube of billiard chalk].

I have no idea why that should have suddenly happened if the script has been working up until now, but either fix it or download it again from the link several posts above.
 
Okay, It was an unedited script, just the one you posted. I will re-download the script , and give it a shot tomorrow.

Thanks for the help
 
Um, can I adjust the script to adventure in the lab level 2?
If so, do I change this
Code:
// This will return the location of the currently most expensive semi-rare
location expensive_semi(string last) {
	item [location] semi_rare;
	semi_rare[$location[The Purple Light District]] = $item[lewd playing card];
	semi_rare[$location[Haunted Billiards Room]] = $item[cube of billiard chalk];
	semi_rare[$location[Outskirts of The Knob]] = $item[Knob Goblin lunchbox];
	semi_rare[$location[Limerick Dungeon]] = $item[cyclops eyedrops];
	remove semi_rare[last. to_location()];
to
Code:
// This will return the location of the currently most expensive semi-rare
location expensive_semi(string last) {
	item [location] semi_rare;
	semi_rare[$location[The Purple Light District]] = $item[lewd playing card];
	semi_rare[$location[Lab: Menagerie 2]] = $item[irradiated pet snacks];
	semi_rare[$location[Outskirts of The Knob]] = $item[Knob Goblin lunchbox];
	semi_rare[$location[Limerick Dungeon]] = $item[cyclops eyedrops];
	remove semi_rare[last. to_location()];
or do I change this
Code:
void fortune_cookie() {
	int last = get_property("semirareCounter").to_int();
	location locale = expensive_semi(get_property("semirareLocation"));
	string billiard = "2";
	if(locale == $location[Haunted Billiards Room]) {
		billiard = get_property("choiceAdventure330");
		if(billiard != "2")
			set_property("choiceAdventure330", "2");
to
Code:
void fortune_cookie() {
	int last = get_property("semirareCounter").to_int();
	location locale = expensive_semi(get_property("semirareLocation"));
	string billiard = "2";
	if(locale == $location[Lab: Menagerie 2]) {
		billiard = get_property("choiceAdventure330");
		if(billiard != "2")
			set_property("choiceAdventure330", "2");
?
Sorry about the many questions, but I'm kind of new to scripting.
Thanks in advance
 
Last edited:
The second instance you suggested is for choice adventure handling in the billiard room. You were on the right track the first time.

There's only two points about your first solution:

1. $location[Lab: Menagerie 2] is not the name of the location. Use $location[Menagerie 2]

2. You do not need to replace the billiard room semi-rare. You can have both as options, unless you really want to prevent that semi-rare from ever being acquired.
 
Shouldn't ~line 53 be
Code:
foreach key in semi_rare
{
	if(mall_price(semi_rare[key]) > expensive)
	{
		best = key;
		expensive = mall_price( semi_rare[key] );
	}
}
As it is currently, expensive is ALWAYS 0, so it only checks if the mallprice of the item is greater than 0, and as such it will always choose the last item in the map, assuming all the items in the map are tradable.
 
Last edited:
This must not happen a lot, but is there a way to catch 'Welcome Back' adventures to avoid fooling the cookie script into thinking it was the wrong number ?

Code:
> Checking counters now.

clan_hobopolis.php?place=8&pwd

[4563] Outskirts of The Knob
Encounter: Welcome Back!
choice.php?whichchoice=277&option=1&pwd
You acquire an item: glimmering roc feather
 > Oops, that wasn't the right number!

[4563] Haunted Library
Encounter: Like the Sunglasses, But Less Comfortable
You acquire an item: black eyedrops
 
Well, that was a recent revision to mafia. And it was a big improvement over the previous revisions that didn't know how to properly catch Welcome Back and lost the cookies.

I'd suggest you take the "Oops, that wasn't the right number" and like it!
 
Bale, love your script.

Would it be possible for it to do something when it gets to 159 turns since the last semirare? Specifically, I'd like it to try to eat another cookie if there is no active counter. And then I'd like it to stop and tell me that I haven't eaten a cookie yet if that fails (bank until tomorrow).
 
Would it be possible for it to do something when it gets to 159 turns since the last semirare? Specifically, I'd like it to try to eat another cookie if there is no active counter. And then I'd like it to stop and tell me that I haven't eaten a cookie yet if that fails (bank until tomorrow).

This script ONLY activates when a counter expires, it doesn't run every turn. So there's no way for it to do that (well it can abort on failing to eat a cookie after hitting a counter, but not preemptively). You'd need to add cookie eating logic to your "betweenBattleScript".
 
Since there seems to be only one cookie variable per mafia instance, rather than character, do you think it's possible put put a "in-run" check in there so the script is ignored if you're in the middle of an ascension?
 
Since there seems to be only one cookie variable per mafia instance, rather than character, do you think it's possible put put a "in-run" check in there so the script is ignored if you're in the middle of an ascension?

Each character has a separate set of counters, including cookie counters. Bale's updated script (in the post just above yours) has the option to ignore the cookie counters (thereby making Mafia abort and alert you) while you're in hardcore or ronin. In fact, it's configured that way by default.
 
Since there seems to be only one cookie variable per mafia instance, rather than character, do you think it's possible put put a "in-run" check in there so the script is ignored if you're in the middle of an ascension?
As StormCrow42 was saying, I'm no longer supporting this script since all of its functions have been usurped by CounterChecker. I changed the name because it does a lot more than just check for semi-rares.

Among many other things, CounterChecker has a per character variable which will turn off automatic semi-rare gathering when you're in hardcore. Although I just realized that should be changed to not getting semi-rares when you're in hardcore or ronin. I'll fix that now. It will do exactly what you want.
 
So I'm trying to incorporate semi-rares into my farming script. I'm still fairly new to ASH, and I'm having trouble figuring out when the counter script gets called. I have the eating of fortune cookies already covered, so all I'm looking to do is have mafia interrupt my farming to automatically get a semi-rare, and then return to the farming script.

Can I do that with Bale's script if I just cut out the "wasting time" function and the eating function? I guess I'm mostly curious about how the counter script gets used. Does Mafia automatically call it before every adventure? And then the default script just stops your auto-adventuring when the counter is up?

**Update : I feel stupid. Somehow missed the previous reply that explained when the function was called. I'll be experimenting with this in the next few days. Thanks for the code, Bale.
 
Tried the new script. Works awesome, at least in the limited capacity that I'm looking for (doing best available semi-rare). Thanks.
 
Back
Top