Difference between revisions of "My name"

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
m
imported>StDoodle
m
Line 1: Line 1:
{{FunctionPage |
+
{{FunctionPage|
 
page_name=my_name|
 
page_name=my_name|
function_category=Your Character |
+
function_category=Your Character|
 
function1_return_type=string|
 
function1_return_type=string|
 
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|
 
title=Code Samples|
 
title=Code Samples|
 
description=This example imports different breakfast scripts depending on which character is running the script.|
 
description=This example imports different breakfast scripts depending on which character is running the script.|
Line 15: Line 15:
 
   import <MultiBreakfast.ash>;
 
   import <MultiBreakfast.ash>;
 
}
 
}
</syntaxhighlight>}} |
+
</syntaxhighlight>}}|
code2={{CodeSample |
+
code2={{CodeSample|
 
description=Note that capitalization is not strictly adhered to (much as with the chat command "/whois" in game). The following two examples are functionally equivalent.|
 
description=Note that capitalization is not strictly adhered to (much as with the chat command "/whois" in game). The following two examples are functionally equivalent.|
 
code=
 
code=
Line 23: Line 23:
 
   //code
 
   //code
 
}
 
}
</syntaxhighlight>}} |
+
</syntaxhighlight>}}|
code3={{CodeSample |
+
code3={{CodeSample|
 
code=
 
code=
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
Line 30: Line 30:
 
   //code
 
   //code
 
}
 
}
</syntaxhighlight>}} |
+
</syntaxhighlight>}}|
see_also={{SeeAlso|my_id}}
+
see_also={{SeeAlso|my_id}}|
 
special=When not logged in, this function returns an empty string.
 
special=When not logged in, this function returns an empty string.
 
}}
 
}}

Revision as of 15:51, 25 February 2010

Function Syntax

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.