openclonk/docs/sdk/script/fn/GetTaggedPlayerName.xml

46 lines
1.9 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>GetTaggedPlayerName</title>
<category>Player</category>
<version>5.1 OC</version>
<syntax>
<rtype>string</rtype>
<params>
<param>
<type>int</type>
<name>player</name>
<desc>Number of the player whose name to get.</desc>
</param>
</params>
</syntax>
<desc>Returns the name of a player, including color markup using the player color. If the specified player number is invalid, <code>nil</code> is returned. Thus this function can also be used to determine whether a player of a given number exists.</desc>
<remark>The markup color is chosen so the player name will be readable on black background. Dark player names are brightened up.</remark>
<examples>
<example>
<code>protected func Entrance(object obj)
{
// has entered a clonk
if(obj-><funclink>GetOCF</funclink>() &amp; <funclink>OCF_CrewMember</funclink>)
<funclink>Log</funclink>(&quot;%s of player %s got the golden crown!&quot;, obj-><funclink>GetName</funclink>(), GetTaggedPlayerName(obj-><funclink>GetOwner</funclink>()));
// or something else?
else
<funclink>Log</funclink>(&quot;The golden crown is now in a %s&quot;, obj-><funclink>GetName</funclink>());
}
protected func Departure(object obj)
{
// has exited something
<funclink>Log</funclink>(&quot;The golden crown has been dropped!&quot;);
}</code>
<text>Object script for a valuable "golden crown". If it is collected by a clonk, a message is displayed in the log that draws attention to the player that collected it.</text>
</example>
</examples>
<related><funclink>GetPlayerName</funclink></related>
</func>
<author>Sven2</author><date>2006-03</date>
</funcs>