Bug Using drinksilent breaks protectAgainstOverdrink

Malibu Stacey

Active member
If you have protectAgainstOverdrink=true (default) you normally get a warning when you attempt to nightcap which you need to click yes or no to proceed.
If you use the drinksilent command on the cli to drink anything prior to nightcapping, the overdrinking warning won't show up when you drink your nightcap.

Steps to reproduce.
  1. set protectAgainstOverdrink=true (or prefref it to make sure it's still true)
  2. drinksilent <any booze you have the liver space to consume> one or more times
  3. do the rest of your KoL day
  4. drink your nightcap using the item manager.
 

fronobulax

Developer
Staff member
First and it could be my search fu, but I cannot find anything in mafia's source path that uses protectAgainstOverdrink. I find that hard to believe but if it is true then the expectation that protectAgainstOverdrink should do anything that wasn't scripted is not correct.

While drinksilent is not documented, drink is. drink will give warning dialogs about ode and overdrinking. A long time ago when the first serious efforts to automate KoL were being made, there were a number of requests for versions of functions that would not, under any circumstances, prompt the user. The goal was total automation. I think drinksilent was one of those. So the intent was that if you called drinksilent you had already made a decision about Ode and whether or not overdrinking was allowed. It could be argued that things are working as designed.

If there really is no built in, overriding protection against overdrinking - if protectAgainstOverdrink really does something and that is stop you from overdrinking then there should be a discussion about what should override what. If there really is a global override then what happens when you really want to have your nightcap? Do you turn it off, drink and then turn it back on?

If there is no overriding protection then this sounds like a feature request for a version of drink that will not prompt and will not overdrink.
 

Veracity

Developer
Staff member
We have a setting named protectAgainstOverdrink in defaults.txt, but I, also, do not find anything about it in the Java code.
Perhaps that was the old way for a script to ignore the nags, before we added drinksilent?

As coded, that property is replaced by an internal (static) variable which is activated the first time you call "drinksilent" and is active for that character for the rest of the day.
Sort of. If you exit the session and restart KoLmafia, or if you log out and login as a different character without exiting KoLmafia and then do the same for the original character, it is cleared for you.

The expectation was that the user would not use "drinksilent" until the nightcap and thus would be overdrunk when the command completed.
Given that expectation, the command is working as expected. As well as working as coded. :)

You are not using the command as "expected", but we could accommodate your usage:

If you use "drinksilent", but the total inebriety consumed by your desired drinks does not make you overdrunk, treat it as a simple "drink".
 

Veracity

Developer
Staff member
So the CONSUME script is intentionally overdrinking?
What, exactly, sort of "attention" do you want from us?
Please explain what you did, what happened, and what you expected.
 

Veracity

Developer
Staff member
I want to understand exactly how drinksilent is being used. That command specifically means “let me overdrink without a warning”.

So, is it the case that CONSUME always uses that and ends up overdrinking before nightcap?

That is a bug in the script.

Or does it use drinksilent when there is no danger of overdrinking and then switches to drink when there is danger - and is unhappy because it disabled the warning?

That is a bug in the script.

Why not ALWAYS use drink - except when you are intentionally drinking your nightcap at the end of the day? You know - use the commands as they are intended to be used?

I stand by my query.
How and when was drinksilent used?
How and when was drink used?
What happened?
What did you expect to happen?
 

heeheehee

Developer
Staff member
FWIWI, this proposed behavior is what I would expect.
Meanwhile, I would expect this to only affect the current command.

Some edge cases that still wouldn't be addressed:

- Break prism, run aftercore turns.
- Overdrink, banking some Stooper turns.
- Change your mind re: spending rollover in aftercore. Equip Drunkula's wineglass, eke out some meatfarming turns because why not.
- Ascend.
- Drink, drink, drink oops now I'm overdrunk

Or:

- Overdrink. (accidentally??)
- Realize your error, use a spice melange, sour ball, whatever else.
- Drink up to inebriety limit, typo `drink 3 cold one` instead of 2.
- Be sad.
 

heeheehee

Developer
Staff member
We have a setting named protectAgainstOverdrink in defaults.txt, but I, also, do not find anything about it in the Java code.
Perhaps that was the old way for a script to ignore the nags, before we added drinksilent?
If anyone's curious about code archaeology: protectAgainstOverdrink was added way back in 2006 and stopped doing anything the following April.
 

Veracity

Developer
Staff member
Meanwhile, I would expect this to only affect the current command.
This is a reasonable interpretation

We have many other dialogs that prompt you to confirm and remember your response - “yes, I really meant it when I said don’t nag me about adventuring without a Mohawk wig. Stop asking me to confirm every time.”

So it is not the only - or even typical - interpretation.
 

Veracity

Developer
Staff member
We also have places where we don’t remember - and it gets annoying.

We are in the Boss Bat zone.
We have fought beefy bats until the Boss Bat might show up.
We give you an MCD nag.
You say “go ahead”.
You get another beefy bat.
You say adventure again - and get another MCD nag.

There is not one true way.
Sometimes (usually) you want to suppress duplicate nags.

So where does “you are about to overdrink” fit in?
 
I think this is specifically a bigger problem with it not notifying you when you are about to drink without Ode.

If you've used something that uses drinksilent, it will no longer stop you if you are about to drink without Ode.
 
Top