My name: Difference between revisions

From Kolmafia
Jump to navigation Jump to search
imported>StDoodle
mNo edit summary
imported>Heeheehee
m Format-fixing.
Line 23: Line 23:
   import <MultiBreakfast.ash>;
   import <MultiBreakfast.ash>;
}
}
</syntaxhighlight>}}|
</syntaxhighlight>}}
code2={{CodeSample|
{{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 31: Line 31:
   //some_code_here
   //some_code_here
}
}
</syntaxhighlight>}}|
</syntaxhighlight>}}
code3={{CodeSample|
{{CodeSample|
code=
code=
<syntaxhighlight>
<syntaxhighlight>

Revision as of 04:12, 22 March 2010

Function Syntax

string my_name()

Returns the name of the logged-in character.

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") {
  //some_code_here
}


if (my_name() == "mycharacter") {
  //some_code_here
}

See Also

my_id()

Special

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