Bug You are too drunk to continue

I think this is fixed with r27647, but let us know if you see this bug again.

The other part of this is that (when it's a combat skill) sometimes we fire "addAvailableSkill" and sometimes "addAvailableCombatSkill". The former recalculates modifiers and the latter doesn't. I am curious as to whether we could just always use the latter.
I'm not sure. The former seems safer to me (if there's a combat skill that also affects modifiers) but less efficient.
 
This is not quite completely fixed in r27647.

I logged in, then was away for a few hours. My login timed out, and when I tried to do something in Mafia, it auto-logged in again. I tried to run some adventures but was given the 'You are too drunk to continue' error, with inebriety 20/14.

I am guessing that whatever was done in r27647 needs to also be applied when a re-login occurs.
 
Hm.

LoginManager.timein -> login -> doLogin -> initialize -> KoLmafia.refreshSession calls refreshSessionData(), which in turn makes a CharSheetRequest; afterwards, refreshSession invokes recalculateAdjustments(), so timing in should be covered in exactly the same way that a normal login is handled.

Indeed, I can't reproduce by logging into various characters and running `timein` in the gCLI. I can try to reproduce by leaving this session open long enough that it times out.

If you could grab a debug log with the results of timing in, that'd be great. (In particular, I just want to verify the request sequence.)

edit: failing that, an excerpt of your session log starting from the timein and ending on the error is probably better than nothing.
 
Last edited:
I consistently get this at the point in my daily script when my aftercore farming ends and I start to do a few post-farming things before ascending. Specifically, I run garbo until I have 75 turns left. I have a check that says if it's over that then to use an autoconfirm to check I want to continue before I do some Spacegate turns. When I choose that I want to continue and the script moves on to sorting out the Spacegate stuff, I find that my liver capacity has been reset (i.e. I lose Drinking to Drink). Changing outfits fixes the issue and allows me to continue.

I'm not sure if the issue is related to the user confirm window "interrupting" the script for a while, but I've taken that out to see if it fixes the issue for me tomorrow so will feed back if that's the case.
 
You only lose one skill? Or do you not pick up skills like Liver of Steel (which pays off for itself in turngen in a 2+ day run)? Could it be tied to liberating the king (since you mentioned aftercore, plausibly between runs)?
 
I encountered this again, but after days of running my aftercore script with no problems. It seems to happen if I have drunk to capacity, then something happens in the script that causes an abort, then I restart and I get the "too drunk" error. A 'refresh all' fixes this.

Sorry I do not have more information - I have either not had time or not been able to reliably reproduce the issue.
 
You only lose one skill? Or do you not pick up skills like Liver of Steel (which pays off for itself in turngen in a 2+ day run)? Could it be tied to liberating the king (since you mentioned aftercore, plausibly between runs)?
I don't grab liver of steel as I loop 1-day CS.

I didn't encounter this issue today - possibly because I removed the userconfirm that used to immediately precede it?
 
OK, this happened again. I got the 'You are too drunk to continue.' after I use a photocopied Embezzler then went through a relativity loop, then fought a sausage goblin.
I do not have a debug log, but here is the session info.

Strangely, it was tricky to get Mafia to recognize my current inebriety limit again. A 'refresh all' did not work, a visit_url("charpane.php") did not work, and a charpane refresh in the relay browser did not work when I was using ChiT. Disabling ChiT, then refreshing the charpane in the relay browser finally did it.
 

Attachments

Hm, that doesn't have a lot to go off of. I assume "drunk check" is printed by your script to check that the inebriety limit is as expected?

Inebriety limit is largely based on skills.

You'd want to visit the charsheet to reload that. I'm surprised `refresh all` didn't do that, though -- that invokes KoLmafia.refreshSession, which should go through the motions of loading the charsheet and recalculating adjustments.

How were you checking that it was updated? Were you just looking at the sidepane in the GUI? Or relying on a script and/or checking inebriety_limit in the graphical CLI?
 
My afteradventure script contains:
Code:
if (my_inebriety()>inebriety_limit()) {
    print("drunk check","olive");
}

I was looking at the sidepane in the GUI, though my recollection was that I would get the error whenever that was incorrect.

Mafia definitely knew I had the correct skills - I did a "modtrace liver" and it listed +6 (same as my first post), even though it thought my inebriety_limit was wrong, and have_skill($skill[liver of steel]) = true.
 
modtrace will always perform the recalculation, since it creates DebugModifiers that forces passive skills to be recached (applyPassiveModifiers is called with debug=true).

The sidepane uses a CharacterListener, which is updated by calls to KoLCharacter.updateStatus(), which... probably doesn't happen some cases.

have_skill() may be getting out of sync with the passive skill cache, but I'm not sure. I'd be surprised if that's still the case.

Can you talk to me more about the sequence around line 437, up until you invoke numberology again? It looks like there was about a 10 minute gap between when you defeated the sausage goblin, and when you used numberology.

Did you leave yourself in the parka choice, time out, and then time back in?

Preference ckbAfterAdvTime changed from 20231026091210150 to 20231026091239206
...
Preference ckbAfterAdvTime changed from 20231026091239206 to 20231026091249732

It further looks like your afterAdventureScript essentially caused itself to be invoked (parka -> numberology choices?).
ckbAfterAdv DONE
ckbAfterAdv DONE
 
Looking back over the rest of the log, I fight a photocopied monster [Knob Goblin Embezzler] with professor staring at [608], and run through a LECTURE ON RELATIVITY loop until fighting the final KGE on turn [621].

My afterAdventureScript runs, which includes:
Code:
string aat = now_to_string("yyyyMMddHHmmssS");
set_property("ckbAfterAdvTime",aat);
print("ckbAfterAdvTime = "+aat,"blue");

The afterAdventureScript:
  1. casts numberology 69
  2. sends my autumn-aton to Shadow Rift
  3. Fights a sausage goblin @ The Bat Hole Entrance
    1. This changes familiar, outfit, and mood
    2. sets a flag to skip running (most) of my afterAdventureScript
    3. fights the sausage goblin
    4. runs the afterAdventureScript again because of the fact the goblin fight uses adv1(), but because of the skip flag, it only prints the timestamp, unsets the flag, prints 'ckbAfterAdv DONE', and returns
    5. changes familiar, outfit, and mood back to the previous setting
    6. Now that the fight is done and we are back to the pre-fight state, run the whole afterAdventureScript again
    7. ckbAfterAdv DONE
  4. ckbAfterAdv DONE

So there are cases that nest the afterAdventureScript inside other parts of the afterAdventureScript... so it does sometimes call itself.


It did not time out and back in. The ckbAfterAdvTime is "yyyyMMddHHmmssS", so Preference ckbAfterAdvTime changed from 20231026091210150 to 20231026091239206 is ~29 seconds.


I ran the whole same script today with no problems. Also, strange that my modtrace and charpane refreshes and 'refresh all' did not seem to reset my inebriety limit. I also find this to occur semi-randomly and it is very hard to reproduce.
 
I had this happen again today, and verified that a modtrace will fix the problem.

> ash my_inebriety()

Returned: 20

> ash inebriety_limit()

Returned: 14

> modtrace liver

type source Liver Capacity
Skill Liver of Steel +5.00 = +5.00
Skill Drinking to Drink +1.00 = +6.00

> ash inebriety_limit()

Returned: 20


The GUI sidepane will report correctly after I refresh the sidepane (with the refresh button on the bottom)
 
After my last run, I tried to replicate this issue. While I did not have Mafia abort with the "You are too drunk to continue" error, I did see the sidepane lash from 15/15 to 15/14 then back to 15/15 as the script ran. I had debug on, and trimmed the log and the debug to when it happened. This is consistent with the same point in my script where the abort happens most every time, so I think something is happening when I am switching what I call 'state'.
'State' is a combination of familiar, equipment, mood, and settings.
 

Attachments

Can you provide more context before "drunk check"? That gets printed very early on in your debug log.

I'll have more time to look into this over the weekend.
 
I believe this is happening during my SetState(), which is this:

Code:
record ckbstate {
    location loc; //location
    familiar fam; //familiar
    int[slot] qip; //equipment
    string[int] mod; //mood
    boolean ode; //Ode to Booze
    string ste; //source terminal educate
    string hos; //horsery
    string coe; //crown of ed
    string buc; //back-up camera
    string ret; //retrocape
    string umb; //umbrella
    string par; //parka
};


//list of all equipment in all slots
int[slot] GetEquip() {
    //print("ckb-One: GetEquip","blue");
    int[slot] eq;
    string ge = "GetEquip: ";
    foreach sl in $slots[hat,weapon,off-hand,back,shirt,pants,acc1,acc2,acc3,familiar] {
        item it = equipped_item(sl);
        int nn = to_int(it);
        if (it!=$item[none]) {
            ge += sl+" "+it+", ";
            eq[sl] = nn;
        }
    }
    if (have_equipped($item[Crown of Thrones])) {
        eq[$slot[crown-of-thrones]] = to_int(my_enthroned_familiar());
        ge += "crown-of-thrones "+my_enthroned_familiar()+", ";
    }
    if (have_equipped($item[Buddy Bjorn])) {
        eq[$slot[buddy-bjorn]] = to_int(my_bjorned_familiar());
        ge += "buddy-bjorn "+my_enthroned_familiar()+", ";
    }
    if (have_equipped($item[card sleeve])) {
        eq[$slot[card-sleeve]] = to_int(equipped_item($slot[card-sleeve]));
        ge += "card-sleeve "+equipped_item($slot[card-sleeve])+", ";
    }
    //print(ge,"olive");
    return eq;
}


//equip equipment into all given slots
void SetEquip(int[slot] eq) {
    print("ckb-One: SetEquip","blue");
    
    //check if we have changed equipment, unequip any slots that are different
    //need to unequip items first to avoid conflicts, unavailable items, and one-at-a-time items
    boolean chkq = false;
    foreach sl in $slots[hat,weapon,off-hand,back,shirt,pants,acc1,acc2,acc3,familiar] {
        item it = to_item(eq[sl]);
        if (it!=$item[none] && equipped_item(sl)!=it) {
            equip(sl,$item[none]);
            chkq = true;
        }
    }
    
    if (chkq) {
        string se = "SetEquip: ";
        foreach sl,nn in eq {
            item it = to_item(nn);
            if ($slots[hat,weapon,off-hand,back,shirt,pants,acc1,acc2,acc3,familiar] contains sl && it!=$item[none]) {
                if (equipped_item(sl)==it) {
                    //nothing
                } else {
                    //print("se it = "+it,"olive");
                    if (available_amount(it)==0) {
                        if (count(get_related(it,"fold"))>0) {
                            cli_execute("fold "+it);
                        } else {
                            cli_execute("refresh inventory");
                        }
                    }
                    if (available_amount(it)==0) { abort("SetEquip error, missing: "+it); }
                    se += sl+" "+it+", ";
                    equip(sl,it);
                }
            }
        }
        if (have_equipped($item[Crown of Thrones])) {
            enthrone_familiar(to_familiar(eq[$slot[crown-of-thrones]]));
        }
        if (have_equipped($item[Buddy Bjorn])) {
            bjornify_familiar(to_familiar(eq[$slot[buddy-bjorn]]));
        }
        if (have_equipped($item[card sleeve])) {
            equip($slot[card-sleeve],to_item(eq[$slot[card-sleeve]]));
        }
        //print(se,"olive");
    }
}


string[int] GetMList() {
    return mood_list();
}

//set mood from mood_list()
void SetMList(string[int] mlst) {
    cli_execute("mood clear");
    foreach ii,ss in mlst {
        ss = to_string(replace_string(ss,",",""));
        ss = to_string(replace_string(ss,"|",","));
        cli_execute("trigger "+ss);
    }
}


//record current character state, includes equipment and other customizables
ckbstate GetState() {
    //print("ckb-One: GetState","blue");
    ckbstate sta;
    sta.loc = my_location();
    sta.fam = my_familiar();
    sta.qip = GetEquip();
    sta.mod = mood_list();
    sta.ode = (have_effect($effect[Ode to Booze])>0);
    sta.ste = get_property("sourceTerminalEducate1")+"-"+get_property("sourceTerminalEducate2");
    sta.hos = get_property("_horsery");
    sta.coe = get_property("edPiece");
    sta.buc = get_property("backupCameraMode");
    sta.ret = get_property("retroCapeSuperhero")+" "+get_property("retroCapeWashingInstructions");
    sta.umb = get_property("umbrellaState");
    sta.par = get_property("parkaMode");
    return sta;
}


//set character state, includes equipment and other customizables
void SetState(ckbstate sta) {
    print("ckb-One: SetState","blue");
    set_location(sta.loc);
    if (!InPathQT() && my_familiar()!=sta.fam) { use_familiar(sta.fam); }
    SetEquip(sta.qip);
    SetMList(sta.mod);
    if (sta.ode) { BuffUp(1,$skill[The Ode to Booze]); }
    SetHorse(sta.hos);
    SetTerm(sta.ste);
    if (have_equipped($item[The Crown of Ed the Undying])) { cli_execute("edpiece "+sta.coe); }
    if (have_equipped($item[backup camera])) { cli_execute("backupcamera "+sta.buc); }
    if (have_equipped($item[unwrapped knock-off retro superhero cape])) { cli_execute("retrocape "+sta.ret); }
    if (have_equipped($item[unbreakable umbrella])) { cli_execute("umbrella "+sta.umb); }
    if (have_equipped($item[Jurassic Parka])) { cli_execute("parka "+sta.par); }
    //mood_execute(-1);
}
 
Another thing I noticed is that I get Familiar weight mismatches, with Mafia reporting:
Familiar weight: KoL = 98 KoLmafia = 97

When this happens, I sometimes see the inebriety_limit change in the sidepane in the GUI, so maybe Mafia is doing some recalculation of things then as well?
 
Another thing I noticed is that I get Familiar weight mismatches, with Mafia reporting:
Familiar weight: KoL = 98 KoLmafia = 97
This is probably the same root cause where the passive skill modifier cache is temporarily losing some (or maybe all) of your skills (in this case, I'm guessing Crimbo Training: Concierge).

I could do the dumb thing of just calling KoLCharacter.recalculateAdjustments() from Modifiers.availableSkillsChanged() but I want to spend some more time (later today?) figuring out exactly why this isn't working.

(Staring at the code. I wonder if this is some code path where ModifierDatabase.resetModifiers() clears that skill cache, and nothing calls recalculateAdjustments() afterwards.)
 
I'm still getting this issue as of r27692, is it still being investigated? (I realise I'm a couple of builds out of date here)
 
Back
Top