My level: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Zarqon
m more links
imported>Bale
mNo edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[int]] [[my_level()]]
{{
#vardefine:name|my_level}}{{
#vardefine:return_type|int}}{{


This function returns the logged-in character's current level as an [[int]].  It is easily used as an initial test to avoid aborts and loops in scripts which attempt to burn adventures in specific areas due to the targeted area being unavailable.  For example:
FunctionPage|
name={{#var:name}}|


<code>
function1={{Function|
[[location]] select_farming_area() {
name={{#var:name}}|
  if ([[my_level()]] >= 10) {
aggregate={{#var:aggregate}}|
    if ([[item_amount]]($[[item]][S.O.C.K.]) + [[item_amount]]($[[item]][intragalactic rowboat]) > 0) {
return_type={{#var:return_type}}|
      return $[[location]][Castle in the Clouds in the Sky];
return_also={{#var:return_also}}|
    } else {
}}|
      return $[[location]][Penultimate Fantasy Airship];
    }
  } else if([[my_level()]] >= 8) {  
      ...etc...
</code>
[[Category:Your Character | My level()]]
[[Category:Ash Functions |My level()]]


When not logged in, this function returns 1.
function_description=Returns the current logged-in character's level.|
 
code1={{CodeSample|
title=Code Sample|
description=The following sample will check to see if you can access the Bat Hole Entryway.|
code=
<syntaxhighlight>
if (my_level() >= 4) {
  print("You can get to the Bat Hole Entryway (may need to visit Council first).");
} else {
  print("You aren't a high enough level to fight bats.");
}
</syntaxhighlight>}}|
 
special=When not logged in, this function returns 1.
}}
 
[[Category:Your Character]]

Latest revision as of 21:32, 21 May 2010

Function Syntax

int my_level()

Returns the current logged-in character's level.

Code Sample

The following sample will check to see if you can access the Bat Hole Entryway.

if (my_level() >= 4) {
   print("You can get to the Bat Hole Entryway (may need to visit Council first).");
} else {
   print("You aren't a high enough level to fight bats.");
}

Special

When not logged in, this function returns 1.