Feature Track milk of magnesium charges

boxbear

New member
"An unused charge of milk of magnesium will persist through rollover, but using another milk of magnesium without first using the charge will overwrite it instead of stack."

Carrying milk charges over rollover does happen, either deliberately (saving more turns for tickets/events) or accidentally (forgot to use milk before being full, or last fullness didn't consume the charge - think hobopolis food).

The single boolean _milkOfMagnesiumUsed doesn't allow tracking both daily milk consumption (only 1 per day) and charge usage (up to 2 per day). I propose adding a _milkOfMagnesiumCharge that doesn't reset at rollover to track charges, whether the milk was used today or before rollover.


net/sourceforge/kolmafia/request/EatItemRequest.java
  • Would update _milkOfMagnesiumCharge instead of _milkOfMagnesiumUsed when detecting the message "magnesium-flavored belch"
  • The nag check for milkUsed would look for _milkOfMagnesiumUsed OR _milkOfMagnesiumCharge

net/sourceforge/kolmafia/request/UseItemRequest.java
  • Would update _milkOfMagnesiumCharge (at the same time as _milkOfMagnesiumUsed) when detecting the message "stomach immediately begins to churn"
  • A different nag could be added if trying to use another milk before using the previous day's charge
 
Last edited:

MCroft

Developer
Staff member
are you proposing this as something you'd like to write and submit a patch for and you're looking for comments?

It looks like a pretty well defined change to me. You say "instead of" in a couple of places above. Are you going to abandon _*Used or still update it? Do you know if any scripts depend on it?
 

boxbear

New member
_milkOfMagnesiumUsed would still track the 1/day milk use. It would no longer record the milk consumption message when it triggers from a previous day's charge, which I think would be an improvement for any script relying on _*Used, but it would otherwise remain updated together with the new property (edited a couple mistakes/insteads above sorry).

I was more generally proposing that kind of change and pointing out the main edits I could see being needed. Currently I'm not even able to compile so it might take very long before I can test anything, though if it's still helpful to submit untested changes I could certainly have a longer look at the rest of the code and try posting something more exhaustive.
 

MCroft

Developer
Staff member
The wiki has compiler setup instructions, if you want to give that a look.

There’s a strong preference for patches that compile, so I’d recommend getting that going.
I asked about replace vs. side-by-side existence because your wording suggested that this replaced the old property. Sounds like that wasn’t what you had in mind.
 
...
I propose adding a _milkOfMagnesiumCharge that doesn't reset at rollover to track charges, whether the milk was used today or before rollover.
...
You'll want to name that without underscore, since underscores are for properties that DO reset at rollover. (With a few exceptions for properties named before that convention was established)
 
Top