openclonk/docs/sdk/script/fn/SetAction.xml

58 lines
2.1 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>SetAction</title>
<category>Objects</category>
<subcat>Activity</subcat>
<version>5.1 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>action</name>
<desc>New action to be set. "ActIdle" or "Idle" will clear any action.</desc>
</param>
<param>
<type>object</type>
<name>target1</name>
<desc>First target object for the action.</desc>
<optional />
</param>
<param>
<type>object</type>
<name>target2</name>
<desc>Second target object for the action.</desc>
<optional />
</param>
<param>
<type>bool</type>
<name>force</name>
<desc>If <code>true</code>, changes the action even if the action defined NoOtherAction=1.</desc>
<optional />
</param>
</params>
</syntax>
<desc>Sets the activity of the calling object. Also see <emlink href="definition/actmap.html">the ActMap</emlink>.</desc>
<remark>If target1 or target2 is omitted or <code>nil</code>, the previously set action target(s) will be preserved. To effectively clear action targets, use <funclink>SetActionTargets</funclink>.</remark>
<remark>The StartCall of the defined action is called during the execution of SetAction. So if the StartCall should happen to delete the object you must not access the object in any way following the call to SetAction!</remark>
<examples>
<example>
<code>SetAction(&quot;Dead&quot;);</code>
<text>The calling clonk will pretend death.</text>
</example>
</examples>
<related>
<funclink>GetAction</funclink>
<funclink>GetActionTarget</funclink>
<funclink>SetPhase</funclink>
<funclink>SetDir</funclink>
</related>
</func>
<author>Sven2</author><date>2003-06</date>
<author>Günther</author><date>2004-12</date>
</funcs>