Category: Get*Val
Since engine version: 1.0 OC
GetDefCoreVal
Description
Returns the property value of an object definition by its name in the DefCore.txt.
Syntax
any GetDefCoreVal(string entry, string section, int entry_number);
Parameters
- entry:
- Name of the entry to be retrieved.
- section:
- [opt] Section of the entry to be retrieved. If not specified, all sections will be searched for an entry of the specified name.
- entry_number:
- [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 entry_number will return the listed id and an uneven entry_number will return the matching count (see example).
Examples
var wdt = GetID()->GetDefCoreVal("Width", "DefCore");
Determines the width an object.
Log(" A tools workshop requires the following material:"); for(var i = 0;; i++) { var id = GetDefCoreVal("Components", "DefCore", ToolsWorkshop, i*2); if(!id) break; var cnt = GetDefCoreVal("Components", "DefCore", ToolsWorkshop, i*2+1); Log("%d x %s", cnt, id->GetName()); }
Determines the necessary components for construction of a workshop.
The loop will run until GetDefCoreVal returns id
The loop will run until GetDefCoreVal returns id
nil
which means the end of the list.