Difference between revisions of "My name"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m
Line 2: Line 2:
 
name=my_name|
 
name=my_name|
 
returns=string|
 
returns=string|
description=Returns the logged-in character's name as a [[string]].}}
+
}}
 
 
[[string]] [[my_name()]]
 
  
 
This function returns the logged-in character's name as a [[string]].
 
This function returns the logged-in character's name as a [[string]].

Revision as of 17:12, 22 February 2010

[[Data Types#{{{return_type}}}|{{{return_type}}}]] my_name()


This function returns the logged-in character's name as a string.

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

 if (my_name() == "zammywarrior") {
   import <Zammy Morning.ash>;
 }
 else if (my_name() == "hippymon") {
   import <Hippy Morning.ash>;
 }

Note that capitalization is not strictly adhered to. When using my_name() the following examples are functionally equivalent:

 if (my_name() == "That FN Ninja") {
     // code
 }

 if (my_name() == "that fn ninja") {
    // code
 }

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