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

63 lines
2.6 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>GetPlrKnowledge</title>
<category>Player</category>
<version>5.1 OC</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>int</type>
<name>player</name>
<desc>Player whose construction plans you want to determine.</desc>
</param>
<param>
<type>id</type>
<name>type</name>
<desc>If specified, the function returns <code>true</code>, if the player has the construction plan of the specified object.</desc>
<optional />
</param>
<param>
<type>int</type>
<name>index</name>
<desc>If <code>type</code> is not specified, this is the index of the construction plan from the list of construction plans.</desc>
<optional />
</param>
<param>
<type>int</type>
<name>category</name>
<desc>If <code>type</code> is not specified, this narrows down the category of the construction plans.</desc>
<optional />
</param>
</params>
</syntax>
<desc>With <code>type</code> specified the function returns <code>true</code> if the player has the construction plan of the specified object. In this case <code>index</code> and <code>category</code> are ignored. Otherwise, the function returns the indicated construction plan of the specified category.</desc>
<examples>
<example>
<code><funclink>if</funclink>(GetPlrKnowledge(0,WindGenerator))
<funclink>Log</funclink>(&quot;Player %s can construct a %s&quot;,<funclink>GetPlayerName</funclink>(0),WindGenerator-&gt;<funclink>GetName</funclink>());</code>
<text>Displays a message if the first player has the construction plan for wind generators.</text>
<code>var def = GetPlrKnowledge( 0,nil,4,<funclink>C4D_Structure</funclink>);
<funclink>Log</funclink>(&quot;The fifth construction plan of the first player is for ID "%i"&quot;,def);</code>
<text />
</example>
</examples>
<related>
<funclink>SetPlrKnowledge</funclink>
<funclink>C4D_All</funclink>
<funclink>C4D_Goal</funclink>
<funclink>C4D_Living</funclink>
<funclink>C4D_Object</funclink>
<funclink>C4D_Rule</funclink>
<funclink>C4D_StaticBack</funclink>
<funclink>C4D_Structure</funclink>
<funclink>C4D_Vehicle</funclink>
</related>
</func>
<author>Günther</author><date>2002-02</date>
</funcs>