Fullness limit: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Heeheehee
m More concise & accurate. Also more documentation.
Line 21: Line 21:
code=
code=
<syntaxhighlight>
<syntaxhighlight>
if(my_fullness() < fullness_limit()) {
if(my_fullness() + 5 <= fullness_limit()) {
   if(fullness_limit() == 15) {
   eat(floor( fullness_limit() / 5 ) , $item[hot hi mein]);
      eat(3 , $item[hot hi mein]);
   // We're using the floor function here because if fullness_limit()/5 returns, say, 2.2, we only want it to consume 2. Also, eat() takes an integer, not a float, as a parameter.
   }
  else if(fullness_limit() == 20) {
      eat(4 , $item[hot hi mein]);
  }
}
}
// Note: This script
</syntaxhighlight>
</syntaxhighlight>
}}|
}}|

Revision as of 04:22, 17 March 2010

Function Syntax

int fullness_limit()

Returns the logged-in character's maximum fullness level as an int. For most characters, the returned value will be 15. On the Feast of Boris this number is raised by 15. The number is also raised by 5 for characters with Stomach of Steel.

Code Samples

This example calculates how many hot hi meins it can eat and then eats them.

if(my_fullness() + 5 <= fullness_limit()) {
   eat(floor( fullness_limit() / 5 ) , $item[hot hi mein]);
   // We're using the floor function here because if fullness_limit()/5 returns, say, 2.2, we only want it to consume 2. Also, eat() takes an integer, not a float, as a parameter.
}
// Note: This script

See Also

my_fullness() | eat()

Special

When not logged in, this function returns 15.