# GetValue

Objects
Status
5.1 OC
int
object base Home base in which to buy. If the CalcValue function is defined in this object, the return value of CalcValue is used.
int for_player 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.
Determines the value of an object. If called as a definition call (e.g. `Rock->GetValue();`), the standard value of the original object definition is returned, otherwise the current value of the calling object.
An object's value is determined as follows: with `base` 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.
Dead animals or clonks always have value 0.
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.
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.
var value = GetValue(); while (value-- > 0) CreateContents(Rock); RemoveObject(true);
Object script: the object creates as many rocks as it is worth and then self-destructs (expelling the rocks).
GetWealth
SetWealth
Sven2
2003-03