<?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>GetMaterialCount</title>
    <category>Landscape</category>
    <subcat>Material</subcat>
    <version>5.1 OC</version>
    <syntax>
      <rtype>int</rtype>
      <params>
        <param>
          <type>int</type>
          <name>material_index</name>
          <desc>Material index</desc>
        </param>
      </params>
    </syntax>
    <desc>Returns the amount of the specified material found in the landscape.</desc>
    <remark>A returns value of -1 indicates that no valid result could yet be determined. Valid results are not available during the first 500 frames of the round or if NoScan is enabled in the scenario core. Results are updated only roughly every 500 frames - inbetween updates values will remain unchanged.</remark>
    <examples>
      <example>
        <code>/* Is the game goal fulfilled? */
public func IsFulfilled()
{
  // Gold hasn't been counted yet
  if ((var gold_count=GetMaterialCount(<funclink>Material</funclink>(&quot;Gold&quot;))) == -1) return false;
  // still too much?
  if (gold_count &gt;= 150) return false;
  // or still gold chunks to mine?
  if(<funclink>ObjectCount</funclink>(<funclink>Find_ID</funclink>(Gold))) return false;
	return true;
}
				</code>
        <text>A script for a goldmine goame goal.</text>
      </example>
    </examples>
    <related><funclink>Material</funclink></related>
  </func>
  <author>wipfmetz</author><date>2002-08</date>
</funcs>
