Bug - Fixed Mood aborts after canticle of carboloading

This one took a while for me to work out.

Logging into a character on mafia (who knows canticle of carboloading, but has already cast it today) and then running the following script:
Code:
void main()
{
	cli_execute("mood execute");
	print("mood executed correctly before canticle","green");
	use_skill($skill[canticle of carboloading]);
	cli_execute("mood execute");
	print("mood executed correctly after canticle","green");
}

Gives the output:
Code:
> tmp.ash

Mood swing complete.
mood executed correctly before canticle
Casting Canticle of Carboloading 1 times...
You can only do that once a day.
KoLmafia declares world peace.
Mood swing complete.

This happens with a mood which only contains a skill, not currently buffed, and unknown to the character. If the skill is known, or is unknown but the effect is active, the problem does not occur.
 

Bale

Minion
Not a bug. Mafia will abort whenever something fails unless you catch the error condition. This is a good thing because it keeps a faulty script from continuing execution. This is definitely a feature.

If you know that something might fail and want to continue execution anyway you can catch the error condition. You can keep your routine from failing if you do this:
Code:
void main()
{
	cli_execute("mood execute");
	print("mood executed correctly before canticle","green");
	if(use_skill($skill[canticle of carboloading])) {}
	cli_execute("mood execute");
	print("mood executed correctly after canticle","green");
}

Or this:
Code:
void main()
{
	boolean catch;
	cli_execute("mood execute");
	print("mood executed correctly before canticle","green");
	catch = use_skill($skill[canticle of carboloading]);
	cli_execute("mood execute");
	print("mood executed correctly after canticle","green");
}

Or this:
Code:
void main()
{
	cli_execute("mood execute");
	print("mood executed correctly before canticle","green");
	(!use_skill($skill[canticle of carboloading]));
	cli_execute("mood execute");
	print("mood executed correctly after canticle","green");
}

Those are all ways of catching the error.
 
Last edited:
No it is actually a bug, perhaps you misunderstood me, mafia is not aborting on canticle it is aborting on the mood. Here is a new example.

Code:
void main()
{
	cli_execute("mood execute");
	print("mood executed correctly before canticle","green");
	use_skill($skill[canticle of carboloading]);
	print("canticle cast executed correctly","green");
	cli_execute("mood execute");
	print("mood executed correctly after canticle","green");
}

which gives the output (when canticle has already been cast, but is known by the player).

Code:
Mood swing complete.
[COLOR="green"]mood executed correctly before canticle[/COLOR]
Casting Canticle of Carboloading 1 times...
You can only do that once a day.
[COLOR="green"][B]canticle cast executed correctly[/B][/COLOR]
KoLmafia declares world peace.
Mood swing complete.

In the scripts i had before, canticle was being cast as the first action in a breakfast script, then hundreds of other things, including eatdrink.ash, automatic nash crosby's still usage, rainbow gravitation, and on and on, all occured successfully until it finally tried to do a bounty, which resulted in a call to burn mana, executing the mood and causing the abort. Thats why i said it was a nightmare to find this bug, the 2 interacting elements were miles apart.

Perhaps there is a separate bug, that trying to cast canticle while you know it but have already used it today does NOT abort and just returns the message "You can only do that once a day.". However there dosen't seem to be a built in mafia property which tracks whether or not it's been used today. I solved my problem by making my own daily property to track it.
 
Last edited:

roippi

Developer
Bump. We know if we've cast canticle now, but.. I'm at a loss for where to start with this bug. I'm actually a little unclear on the scope of the bug. Is it limited to specifically canticle of carboloading in moods, or..?

Or was this fixed by properly putting a casting limit on canticle?

ETA: I'm guessing it did. I imagine that without the limit, the mood didn't know to -not- cast canticle, tried to, and when it failed caused an abort. Marking fixed.
 
Last edited:
It was a long time ago, so I wouldn't be surprised if it got fixed.
It wasn't to do with canticle being in a mood. The bug occured if you tried to cast it through the CLI after it had already been cast.
When you did that, all moods from that point onwards failed, until Mafia was closed and restarted.

I found it because canticle used to be part of a breakfast script I had. Occassionally the script failed, and I had to run it twice. I worked around it by adding my own variable recording whether canticle had been cast.

I don't have canticle right now, so I can't test it. Does mafia now abort if you try to cast it more than once?
 

roippi

Developer
Huh. That behavior is pretty undesirable.

Mafia will now stop you from casting if you've already cast today, though, so ideally you shouldn't get into that state.
 
Top