GetDefCoreVal

Category: Get*Val
Since engine version: 4.9.1.0 GWE

Description

Returns the property value of an object definition by its name in the DefCore.txt.

Syntax

any GetDefCoreVal (string strEntry, string strSection, id idDef, int iEntryNr);

Parameters

strEntry:
Name of the entry to be retrieved
strSection:
[opt] Section of the entry to be retrieved. If 0, all sections will be searched for an entry of the specified name.
idDef:
[opt] Object definition of which to get an entry. If 0, the definition of the calling object is used.
iEntryNr:
[opt] Index of the value to be retrieved if an entry contains multiple values.

Remark

If the requested entry is an id list (e.g. "Components" in DefCore.txt) an even iEntryNr will return the listed id and an uneven iEntryNr will return the matching count (see example).

Examples

var wdt = GetDefCoreVal("Width", "DefCore", GetID());
Determines the width of an object. The last two parameters might be omitted in this case.
Log(" Eine Werkstatt benötigt folgendes Material:");

for(var i = 0;; i++)
{
  var id = GetDefCoreVal("Components", "DefCore", WRKS, i*2);
  if(!id) break;
  var cnt = GetDefCoreVal("Components", "DefCore", WRKS, i*2+1);

  Log("%d x %s", cnt, GetName(0, id));
}
Determines the necessary components for construction of a workshop.
The loop will run until GetDefCoreVal returns id 0 which means the end of the list
See also: GetActMapVal, GetObjectInfoCoreVal, GetObjectVal, GetPlayerInfoCoreVal, GetPlayerVal, GetScenarioVal
PeterW, April 2002