<?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>GetValue</title>
    <category>Objects</category>
    <subcat>Status</subcat>
    <version>5.1 OC</version>
    <syntax>
      <rtype>int</rtype>
      <params>
        <param>
          <type>object</type>
          <name>base</name>
          <desc>Home base in which to buy. If the CalcValue function is defined in this object, the return value of CalcValue is used.</desc>
          <optional />
        </param>
        <param>
          <type>int</type>
          <name>for_player</name>
          <desc>Player to whom the value applies. If the CalcValue function is defined in this object, the return value of CalcValue is used in this case also.</desc>
          <optional />
        </param>
      </params>
    </syntax>
    <desc>Determines the value of an object. If called as a definition call (e.g. <code>Rock-&gt;GetValue();</code>), the standard value of the original object definition is returned, otherwise the current value of the calling object.<br/>An object's value is determined as follows: with <code>base</code> specified it is first checked whether the CalcValue function is defined in the object's script and if so, it is evaluated. Otherwise, the definition value is used (see below). The resulting value is then reduced according to the object's completion.<br/>Dead animals or clonks always have value 0.<br/>The definition value is determined as follows: if the function CalcDefValue is defined in the definition script, it is evaluated. Otherwise, the value overload from Scenario.txt is used, if present. Otherwise, the standard value from DefCore is used.</desc>
    <remark>The two parameters base and for_player are designed for use in special trading in individual scenarios and are only processed by CalcValue/CalcDefValue calls.</remark>
    <examples>
      <example>
        <code>var value = GetValue();
<funclink>while</funclink> (value-- &gt; 0) <funclink>CreateContents</funclink>(Rock);
<funclink>RemoveObject</funclink>(true);</code>
        <text>Object script: the object creates as many rocks as it is worth and then self-destructs (expelling the rocks).</text>
      </example>
    </examples>
    <related>
      <funclink>GetWealth</funclink>
      <funclink>SetWealth</funclink>
    </related>
  </func>
  <author>Sven2</author><date>2003-03</date>
</funcs>
