To class

From Kolmafia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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