Overdrink: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
Convert to Template:Function2 format
No edit summary
Line 24: Line 24:


<p>Using this command, rather than {{f|drink}}, suppresses warning dialogs for overdrinking and drinking without Ode to Booze.</p>
<p>Using this command, rather than {{f|drink}}, suppresses warning dialogs for overdrinking and drinking without Ode to Booze.</p>
<p>The second form (item, quantity) was added in [https://kolmafia.us/threads/19548-add-method-chaining-variants-for-ash-functions-overdrink-retrieve_item-buy.24218/ r19548].</p>
|code1={{CodeSample
|code1={{CodeSample
   |title=Code Samples
   |title=Code Samples

Revision as of 13:16, 23 December 2020

Function Syntax

boolean overdrinkint qty, item consume )

Attempts to drink a given number of item(s), suppressing overdrinking warnings.
  • qty: Quantity of item to drink
  • consume: Item to drink

boolean overdrinkitem consume, int? qty = 1 )

Attempts to drink a given number of item(s), suppressing overdrinking warnings.
  • consume: Item to drink
  • qty: Quantity of item to drink

Attempts to drink qty amount of item consume. Returns true on success, false on failure. (The return value does not reflect whether or not the items were actually consumed.)

Using this command, rather than drink(), suppresses warning dialogs for overdrinking and drinking without Ode to Booze.

The second form (item, quantity) was added in r19548.

Code Samples

This will drink 1 Mae West without Ode without a warning if you are unable to get Ode.

if ( !have_skill( $skill[ The Ode to Booze ] ) && !can_interact() )
{
   // Make sure we are not over drinking with the Mea West
   if ( inebriety_limit() >= my_inebriety() + 4 ) {
      print( "You don't have Ode and can't get it, drinking Mae West anyways." );
      overdrink( 1, $item[ Mae West ] ); // Overdrink Prevents Ode Warning
   }
   else
   {
      print( "You do not have enough inebriety left to prevent overdrunkeness" );
   }
}
else
{
   print( "You should cast or acquire the Ode Buff before drinking." );
}

Beware: Since it suppresses the overdrink warning, it is wise to do checks to assure you don't accidentally overdrink when using it to prevent the Ode Warning.

CLI Equivalent

The CLI command "drink" works similarly.

See Also

can_drink() | drink() | inebriety_limit() | my_inebriety()