Difference between revisions of "StartAction"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
==startAction==
<span class="bold">Command History</span>
 
<div class="mw-collapsible-content">
 
<div class="alt-bg">Available since v3.7</div>
 
</div></div>
 
  
 +
<div class="command-min-version-info">Available since: <span class="command-min-version">v3.0</span></div>
  
Allows you to start any "called by other action" you include!
+
<div class="command-doc">Starts an action. If the action is already running a new active action for the action data object is started.</div>
  
 
+
Lua Syntax:
Syntax:
+
<pre class="command-syntax">startAction(action)</pre>
 +
===Arguments===
 +
====action====
 +
:'''"object path"|"object id"|object''' - Visionaire object which specifies an action.
 +
===Flags===
 +
===Return Values===
 +
;visionaireObject
 +
:The visionaire object representing the active action.
 +
===Examples===
 +
Example 1:  
 
<syntaxhighlight>
 
<syntaxhighlight>
startAction(action)
 
</syntaxhighlight>
 
 
 
Example 1: basic start action method
 
<syntaxhighlight enclose="div">
 
--[[
 
!important: you must take care when using this method that there is only one instance of the action you are calling.
 
--]]
 
 
-- shortened get action method; !important: see comment above!
 
startAction("Actions[action_name]")
 
 
 
-- full get action method; !recommended
 
 
startAction("Scenes[scene_name].SceneObjects[object_name].SceneActions[action_name]")
 
startAction("Scenes[scene_name].SceneObjects[object_name].SceneActions[action_name]")
 
</syntaxhighlight>
 
</syntaxhighlight>
 
+
Example 2:  
Example 2: start action via a variable
 
 
<syntaxhighlight>
 
<syntaxhighlight>
-- you can of course use variables with actions stored in them instead!
 
 
local act = getObject("Actions[action_name]")
 
local act = getObject("Actions[action_name]")
 
startAction(act)
 
startAction(act)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
 
 
<span class="bold underline">Arguments</span>
 
 
<span class="bold">action</span>: path <br/>
 
The path to the action to be started! ("path"."object_id"."action")
 
 
 
<span class="bold underline">Flags</span>
 
 
none
 
 
 
<span class="bold underline">Return</span>
 
 
<span class="bold">visionaireObject</span> <br/>
 
The visionaire object representing the active action!
 
{{i18n|StartAction}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span class="bold">Relevant Pages</span>: [[StopAction|stopAction]]
 
|}
 

Revision as of 18:12, 22 November 2013

startAction

Available since: v3.0
Starts an action. If the action is already running a new active action for the action data object is started.

Lua Syntax:

startAction(action)

Arguments

action

"object path"|"object id"|object - Visionaire object which specifies an action.

Flags

Return Values

visionaireObject
The visionaire object representing the active action.

Examples

Example 1:

startAction("Scenes[scene_name].SceneObjects[object_name].SceneActions[action_name]")

Example 2:

local act = getObject("Actions[action_name]")
startAction(act)