My class: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
No edit summary
imported>Bale
mNo edit summary
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[class]] <b>my_class</b>()
{{
#vardefine:name|my_class}}{{
#vardefine:return_type|class}}{{


This function returns the logged-in character's current class as a [[class]].
FunctionPage|
name={{#var:name}}|
function1={{Function|
name={{#var:name}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}
}}|
function_description=Returns the current class of the logged-in character.|
code1={{CodeSample|
title=Code Sample|
description=The following decides how many big rocks to acquire based on the character's class:|
code=
<syntaxhighlight>
int rocks = 1;


As an example, the following code snippet decides how many big rocks to acquire based on the character's class:
if (my_class() == $class[seal clubber] || my_class() == $class[turtle tamer] || my_class() == $class[disco bandit]) {
  rocks = 2
}
</syntaxhighlight>}}|
special=When not logged in, this function returns $[[class]][none].
}}


<code>
[[Category:Your Character]]
  [[int]] rocks;
 
  if([[my_class()]] == $[[class]][Seal Clubber] ||
  [[my_class()]] == $[[class]][Turtle Tamer] ||
  [[my_class()]] == $[[class]][Disco Bandit]) {
    rocks = 2;
  } else {
    rocks = 1;
  }
</code>
[[Category:Your Character | My class()]]
[[Category:Ash Functions |My class()]]

Latest revision as of 21:32, 21 May 2010

Function Syntax

class my_class()

Returns the current class of the logged-in character.

Code Sample

The following decides how many big rocks to acquire based on the character's class:

int rocks = 1;

if (my_class() == $class[seal clubber] || my_class() == $class[turtle tamer] || my_class() == $class[disco bandit]) {
   rocks = 2
}

Special

When not logged in, this function returns $class[none].