My name: Difference between revisions
Jump to navigation
Jump to search
imported>Zarqon m added more links, improved formatting for consistency |
imported>Zarqon m more links |
||
Line 6: | Line 6: | ||
<pre> | <pre> | ||
if (my_name() == "zammywarrior") { | if (my_name() == "zammywarrior") { | ||
import <Zammy Morning.ash>; | [[import]] <Zammy Morning.ash>; | ||
} | } | ||
else if ([[my_name()]] == "hippymon") { | else if ([[my_name()]] == "hippymon") { | ||
import <Hippy Morning.ash>; | [[import]] <Hippy Morning.ash>; | ||
} | } | ||
</pre> | </pre> | ||
Line 17: | Line 17: | ||
<code> | <code> | ||
if ([[my_name()]] == "My Capitalized Name") { | if ([[my_name()]] == "My Capitalized Name") { | ||
// this block of commands will never be performed | [[comments|// this block of commands will never be performed]] | ||
} | } | ||
</code> | </code> |
Revision as of 09:02, 31 January 2009
This function returns the logged-in character's name as a string in all lowercase.
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 even if your name is capitalized in KoL, my_name() will convert it to lowercase:
if (my_name() == "My Capitalized Name") {
// this block of commands will never be performed
}
When not logged in, this fuction returns an empty string.