My inebriety: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Zarqon
added more examples and not logged in info
imported>Bale
mNo edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[int]] [[my_inebriety()]]
{{
#vardefine:name|my_inebriety}}{{
#vardefine:return_type|int}}{{


This function returns the logged-in character's current level of drunkenness as an [[int]].  Common uses include 1) checking to see if you are drunk:
FunctionPage|
name={{#var:name}}|


<code>
function1={{Function|
  if ([[my_inebriety()]] > [[inebriety_limit()]]) abort("You are too plastered to continue.");
name={{#var:name}}|
</code>
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}|
}}|


2) With the help of [[inebriety_limit()]], drinking for the character without overdrinking:
function_description=Returns the logged-in character's current level of drunkenness.|


<code>
code1={{CodeSample|
  if ([[inebriety_limit()]] - [[my_inebriety()]] < 5) {
title=Code Samples|
    [[int]] advisable = [[inebriety_limit()]] - [[my_inebriety()]] - 1;
description=Checking to see if your character is drunk:|
    [[drink]](advisable,$[[item]][Ram's Face Lager]);
code=
  }
<syntaxhighlight>
</code>
if (my_inebriety() > inebriety_limit()) abort("You are too plastered to continue.");
</syntaxhighlight>}}|


And 3) drinking as many as possible of something:
see_also={{SeeAlso|inebriety_limit}}|
special=When not logged in, this function returns 0.
}}


<code>
[[Category:Your Character]]
  drink(floor(([[inebriety_limit()]]-[[my_inebriety()]]) / 2), $item[shot of peach schnapps]);
</code>
[[Category:Your Character | My inebriety()]]
[[Category:Ash Functions | My inebriety()]]
 
When not logged in, this function returns 0.

Latest revision as of 21:40, 21 May 2010

Function Syntax

int my_inebriety()

Returns the logged-in character's current level of drunkenness.

Code Samples

Checking to see if your character is drunk:

if (my_inebriety() > inebriety_limit()) abort("You are too plastered to continue.");

See Also

inebriety_limit()

Special

When not logged in, this function returns 0.