Bug - Fixed Conditions and KoLmafia.continuationState / KoLmafia.hadPendingState

slyz

Developer
I think my solution isn't a solution at all. I have a few ideas, but I think I need to understand better how ASH works.

adventure() was the only function that had a reliable return value, but that's not the case anymore. I guess a lot of scripts count on it, so maybe it would be better to revert that commit.
 

fronobulax

Developer
Staff member
I guess a lot of scripts count on it, so maybe it would be better to revert that commit.

I did NOT want to read that :-( Obviously I consider myself responsible for fixing the problem or reverting the commit so let me know what your recommendation is.
 

Theraze

Active member
Best would be if we can find a way to make matching conditions still return something positive and not make mafia believe it's out of adventures. Wasn't just zlib that was causing it, was anytime I had adventures satisfied yesterday that it expected the conditions being done to mean that I was out of adventures. Adventuring continued, but the message was definitely buggy.
 

slyz

Developer
The problem with my solution is that it doesn't take into account the fact that a new ASH interpreter can be created between the moment a function starts and the moment it is done.

My idea would be to have a "hadPendingState" attribute specific to each function call (or to each interpreter), instead of having a single global "hadPendingState" that might be reset before a function is done.

In the meanwhile, I think it would be better to revert the commit, so as not to break a few widely-used scripts.
 

Theraze

Active member
As I said, it wasn't breaking the script, it just said it was broken. We definitely don't want to leave it as it stands, because the message is pure wrong... but since it's apparently fixing other bugs (like the recovery script/mood/manual recovery bug), having it in place is probably better than not. Just needs to be fixed or reverted before another version bump happens. :)
 

slyz

Developer
adventure( X, loc ) should return true only if X adventures where spend in loc. Right now, it can return true even if fewer adventures where spend (if you ran out of adventures, or if you fulfilled your goals) but Mafia's automatic recovery went well.
 

slyz

Developer
Here is a new patch with a slightly more complicated solution. I posted about it on the dev forum, in case Hola happens to have some free time to look at the problem and give some advice.

It would be great if someone could use it for a while and see if it fixes the problem without creating any new one.
 

Attachments

  • continueValue.patch
    5.4 KB · Views: 29

Theraze

Active member
There are still some weird messages sometimes, but on a whole, it's working better. If I run across one of the messages where it says I've run out of adventures or something similar and it's off, I'll post it. If we want to close this though, I can make a proper bug report when I can replicate it repeatedly.
 
Top