Difference between revisions of "My name"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m
Line 2: Line 2:
 
{{#vardefine:return_type|string}}
 
{{#vardefine:return_type|string}}
 
{{FunctionPage|
 
{{FunctionPage|
 +
needscode=yes|
 
name={{#var:name}}|
 
name={{#var:name}}|
 
function_category=Your Character|
 
function_category=Your Character|

Revision as of 01:44, 3 March 2010


needs(code_samples);

Function Syntax

string my_name()

Returns the name of the logged-in character, all in lowercase.

Code Samples

This example imports different breakfast scripts depending on which character is running the script.

if (my_name() == "MyMain") {
  import <MainBreakfast.ash>;
}
else if (my_name() == "MyMulti") {
  import <MultiBreakfast.ash>;
}

Note that capitalization is not strictly adhered to (much as with the chat command "/whois" in game). The following two examples are functionally equivalent.

if (my_name() == "MyCharacter") {
  //code
}
if (my_name() == "mycharacter") {
  //code
}

See Also

my_id()

Special

When not logged in, this function returns an empty string.