Difference between pages "Have shop" and "Overdrink"

From Kolmafia
(Difference between pages)
Jump to navigation Jump to search
imported>Eliteofdelete
 
imported>Eliteofdelete
(Code Example)
 
Line 1: Line 1:
 
{{
 
{{
#vardefine:name|have_shop}}{{
+
#vardefine:name|overdrink}}{{
 
#vardefine:return_type|boolean}}{{
 
#vardefine:return_type|boolean}}{{
  
 
FunctionPage|
 
FunctionPage|
 
 
name={{#var:name}}|
 
name={{#var:name}}|
  
Line 11: Line 10:
 
aggregate={{#var:aggregate}}|
 
aggregate={{#var:aggregate}}|
 
return_type={{#var:return_type}}|
 
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
+
return_also={{#var:return_also}}|
 +
parameter1={{Param|int|qty}}|
 +
parameter2={{Param|item|consume}}|
 +
p1desc={{Pspan|qty}} is the quantity to drink|
 +
p2desc={{Pspan|consume}} is the item to drink|
 
}}|
 
}}|
  
function_description=Returns true if you have a mall store, false otherwise.|
+
function_description=Will attempt to drink {{pspan|qty}} amount of item {{pspan|consume}}. Returns true for drinkable items and false for items that are not. (The return value does not reflect whether or not the items were actually consumed.) Using this command, rather than {{f|drink}}, suppresses warning dialogs for overdrinking and drinking without Ode to Booze.|
  
 
code1={{CodeSample|
 
code1={{CodeSample|
 
title=Code Samples|
 
title=Code Samples|
description=Informs you if you have a shop in the mall of loathing. If not, it checks to see if you are able to get one.|
+
description=This will drink Mae West without Ode without a warning if you are unable to get Ode.|
 
code=
 
code=
 
<syntaxhighlight>
 
<syntaxhighlight>
if (have_shop())
+
if (!have_skill($skill[The Ode to Booze]) && !can_interact()) {
   print("You have a shop in the Mall of Loathing!", "green");
+
   if (inebriety_limit() >= my_inebriety()+4) { //Make sure we are not over drinking with the Mea West
else if (my_meat() < 50000)
+
      print("You don't have Ode and can't get it, drinking Mae West anyways.");
  print("You need 50,000 meat for a shop!", "red");
+
      overdrink(1, $item[Mae West]); //Overdrink Prevents Ode Warning
else if (my_level() < 9)
+
  }
   print("You need to be at least level 9 to purchase a shop", "red");
+
   else print("You do not have enough inebriety left to prevent overdrunkeness");
else print("You currently do not have a shop but have the means to get one. You should buy one.", "green");
+
 +
else print("You should cast or acquire the Ode Buff before drinking.");  
 
</syntaxhighlight>|
 
</syntaxhighlight>|
 
+
moreinfo=
 +
Checks to see if you have Ode and that you can't get it from a buff bot. Then it drinks it "silently" after making sure it won't overdrink off of it.
 
}}|
 
}}|
  
see_also={{SeeAlso|have_display}}|
+
see_also={{SeeAlso|can_drink|drink|inebriety_limit|my_inebriety}}|
special=This function returns false if no character is logged in.|
+
cli_equiv=The CLI command "drink" works similarly.|
 
}}
 
}}
  
 
[[Category:Item Management]]
 
[[Category:Item Management]]

Revision as of 13:17, 2 January 2015

Function Syntax

boolean overdrink(int qty ,item consume )

  • qty is the quantity to drink
  • consume is the item to drink

Will attempt to drink qty amount of item consume. Returns true for drinkable items and false for items that are not. (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.

Code Samples

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

if (!have_skill($skill[The Ode to Booze]) && !can_interact()) {
   if (inebriety_limit() >= my_inebriety()+4) { //Make sure we are not over drinking with the Mea West
      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.");

Checks to see if you have Ode and that you can't get it from a buff bot. Then it drinks it "silently" after making sure it won't overdrink off of it.

CLI Equivalent

The CLI command "drink" works similarly.

See Also

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