Difference between revisions of "My name"

From Kolmafia
Jump to navigation Jump to search
imported>ZammyWarrior
imported>Zarqon
(Corrected and expanded information)
Line 1: Line 1:
 
[[string]] [[my_name()]]
 
[[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]] in all lowercase.
  
 
[[Category:Your Character | My name()]]
 
[[Category:Your Character | My name()]]
[[Category:Ash Functions |My name()]]
+
[[Category:Ash Functions | My name()]]
 
<pre>#Script checks players name. If your name returns ZammyWarrior it will import Zammy Morning.ash script.
 
<pre>#Script checks players name. If your name returns ZammyWarrior it will import Zammy Morning.ash script.
 
#If name returns Hippymon it will import Hippymon Morning.ash script.
 
#If name returns Hippymon it will import Hippymon Morning.ash script.
 
#Great script for one with multiple accounts as a "breakfast script".
 
#Great script for one with multiple accounts as a "breakfast script".
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>
 +
 +
Note that even if your name is capitalized in KoL, my_name() will convert it to lowercase:
 +
 +
<pre>if (my_name() == "My Capitalized Name") {
 +
  // this block of commands will never be performed
 +
}</pre>

Revision as of 04:24, 29 January 2009

string my_name()

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

#Script checks players name. If your name returns ZammyWarrior it will import Zammy Morning.ash script.
#If name returns Hippymon it will import Hippymon Morning.ash script.
#Great script for one with multiple accounts as a "breakfast 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
}