To class

From Kolmafia
Revision as of 14:39, 26 January 2015 by imported>Eliteofdelete
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Function Syntax

class to_class(int convert )

class to_class(string name )

  • name is the class int or name to convert

Returns the specified class name as a class.

Code Samples

Following example shows basic to_class operations.

print(to_class("DiScO BanDiT"), "green");
print(to_class("disco ban"), "red");
print("");
if (to_class("DiScO BanDiT") == my_class())
   print("I am a Disco Bandit!", "green");
else print("I am not a Disco Bandit...", "blue");

It gives the following output (for DBs).

Disco Bandit
none

I am a Disco Bandit!

Special

Unlike direct casting with $class[ ], this function is case-insensitive. Full name is still required (partial names, or names with extra characters, return $class[ none ]).