My class: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Zarqon
mNo edit summary
imported>StDoodle
mNo edit summary
Line 1: Line 1:
[[class]] [[my_class()]]
{{DISPLAYTITLE:my_class()}}
{{function|
name=my_class|
returns=class|
}}


This function returns the logged-in character's current class as a [[class]].
This function returns the logged-in character's current class as a [[class]].
Line 15: Line 19:
</code>
</code>
[[Category:Your Character | My class()]]
[[Category:Your Character | My class()]]
[[Category:Ash Functions |My class()]]


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

Revision as of 20:43, 22 February 2010

[[Data Types#{{{return_type}}}|{{{return_type}}}]] my_class()


This function returns the logged-in character's current class as a class.

As an example, the following code snippet 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;
 }

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