My name: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>StDoodle
mNo edit summary
Line 8: Line 8:
aggregate={{#var:aggregate}}|
aggregate={{#var:aggregate}}|
return_type={{#var:return_type}}|
return_type={{#var:return_type}}|
return_also={{#var:return_also}}}}
return_also={{#var:return_also}}}}|
function_description=Returns the name of the logged-in character, all in lowercase.|
function_description=Returns the name of the logged-in character, all in lowercase.|
code1={{CodeSample|
code1={{CodeSample|

Revision as of 12:00, 28 February 2010


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.