My class: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>Efilnikufecin
No edit summary
imported>Zarqon
m added not-logged-in info, reformatted code to be more legible
Line 6: Line 6:


<code>
<code>
   [[int]] rocks;
   [[int]] rocks = 1;
    
    
   if([[my_class()]] == $[[class]][Seal Clubber] ||
   if ([[my_class()]] == $[[class]][seal clubber] ||
  [[my_class()]] == $[[class]][Turtle Tamer] ||
      [[my_class()]] == $[[class]][turtle tamer] ||
  [[my_class()]] == $[[class]][Disco Bandit]) {
      [[my_class()]] == $[[class]][disco bandit]) {
     rocks = 2;
     rocks = 2;
  } else {
    rocks = 1;
   }
   }
</code>
</code>
[[Category:Your Character | My class()]]
[[Category:Your Character | My class()]]
[[Category:Ash Functions |My class()]]
[[Category:Ash Functions |My class()]]
When not logged in, this function returns $class[none].

Revision as of 04:40, 29 January 2009

class 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].