forked from Mirrors/openclonk
27 lines
1.7 KiB
XML
27 lines
1.7 KiB
XML
<?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>ObjectNumber</title>
|
|
<category>Objects</category>
|
|
<version>5.1 OC</version>
|
|
<syntax><rtype>int</rtype></syntax>
|
|
<desc>Returns the object number of an object. This number always uniquely identifies an object, even in subsequent savegame runs. Using <funclink>Object</funclink> it can be converted back to an object pointer.</desc>
|
|
<examples>
|
|
<example>
|
|
<code>func Activate(caller)
|
|
{
|
|
caller-><funclink>CreateMenu</funclink>(<funclink>GetID</funclink>(), caller, 0, "No chopable objects in the vicinity!");
|
|
<funclink>for</funclink>(var obj in <funclink>FindObjects</funclink>(<funclink>Find_InRect</funclink>(-50, -50, 100, 100), <funclink>Find_OCF</funclink>(<funclink>OCF_Chop</funclink>), <funclink>Find_NoContainer</funclink>()))
|
|
caller-><funclink>AddMenuItem</funclink>("Chop down %s", <funclink>Format</funclink>("SetCommand(this, \"Chop\", Object(%d))", obj->ObjectNumber()), obj-><funclink>GetID</funclink>());
|
|
}</code>
|
|
<text>This function opens a menu in the calling object which contains all chopable objects (<funclink>OCF_Chop</funclink>) in the object's vicinity. Selecting a menu entry then uses <funclink>SetCommand</funclink> to set the command "Chop" in the object. Since this requires storage of the object pointer, the pointer is first converted into the object number.</text>
|
|
</example>
|
|
</examples>
|
|
<related><funclink>Object</funclink></related>
|
|
</func>
|
|
<author>PeterW</author><date>2003-02</date>
|
|
</funcs>
|