Difference between revisions of "StartAction"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"> <b>Command History</b> <div class="mw-collapsible-co...")
 
Line 15: Line 15:
 
Example:
 
Example:
 
<syntaxhighlight>
 
<syntaxhighlight>
startAction([getObject("Actions[action_name]")])
+
-- shortened get action method
 +
startAction([getObject("Actions[action_name]")]) -- !important: you must not have more than one action with the same name!
  
 
-- you can of course use variables with actions stored in them instead!
 
-- 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)
 +
 +
-- you can also link to actions inside of scenes, objects, buttons, interfaces etc.
 +
local act = getObject("Scenes[scene_name].SceneObjects[object_name].SceneActions[action_name]")
 +
startAction(act)
 +
 +
--[[
 +
note: it is recommended to use full paths to objects, actions, animations etc as you don't have to worry about
 +
them not working due to multiple instances using the same name!
 +
--]]
 
</syntaxhighlight>
 
</syntaxhighlight>
  

Revision as of 22:17, 6 March 2013

Command History

Available since v3.7


Allows you to start any "called by other action" you include!

Syntax:

startAction(action)

Example:

-- shortened get action method
startAction([getObject("Actions[action_name]")]) -- !important: you must not have more than one action with the same name!

-- you can of course use variables with actions stored in them instead!
local act = getObject("Actions[action_name]")
startAction(act)

-- you can also link to actions inside of scenes, objects, buttons, interfaces etc.
local act = getObject("Scenes[scene_name].SceneObjects[object_name].SceneActions[action_name]")
startAction(act)

--[[
note: it is recommended to use full paths to objects, actions, animations etc as you don't have to worry about
them not working due to multiple instances using the same name!
--]]


Arguments

action: link
The link to the action to be started! ("path|"object_id"|"action_name")

Flags: none

Return: visionaireObject
The visionaire object representing the active action!