Difference between revisions of "GetObject (CMS)"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div class="toccolours mw-collapsible mw-collapsed tbl-ds"> <span class="bold">Command History</span> <div class="mw-collapsible-content"> <div class="alt-bg">Available since ...")
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
{| class="toccolours mw-collapsible mw-collapsed ex"
<span class="bold">Command History</span>
+
! Function history
<div class="mw-collapsible-content">
+
|-
<div class="alt-bg">Available since v3.0</div>
+
| Available since v3.0
</div></div>
+
|}
  
 
Allows you to access, read & manipulate the data tables for the linked object, item, character, condition, & value etc...
 
Allows you to access, read & manipulate the data tables for the linked object, item, character, condition, & value etc...
  
<div class="toccolours mw-collapsible mw-collapsed tbl-ds">
+
{| class="toccolours mw-collapsible mw-collapsed ex"
<span class="bold">Additional Info</span>
+
! Additional Info
<div class="mw-collapsible-content">
+
|-
<div>''!important'': The object names are case sensitive.</div>
+
| ''!important'': The object names are case sensitive.
</div></div>
+
|}
  
  
 
Syntax:
 
Syntax:
 
<syntaxhighlight>
 
<syntaxhighlight>
getObject("path[object]")
+
getObject("path[object, error]")
 
</syntaxhighlight>
 
</syntaxhighlight>
  
Line 23: Line 23:
 
<syntaxhighlight>
 
<syntaxhighlight>
 
-- This method is unsafe because it accesses all the condition/value tables associated with the project
 
-- This method is unsafe because it accesses all the condition/value tables associated with the project
getObject("Conditions[door_open]") -- get a condition
+
getObject("Conditions[condition_name]") -- get a condition
getObject("Values[money]") -- get a value
+
getObject("Values[value_name]") -- get a value
 +
getObject("Actions[action_name]") -- get an action
 +
getObject("Animations[animation_name]") -- get an animation
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
Example 2: Full getObject method.
 
Example 2: Full getObject method.
 
<syntaxhighlight>
 
<syntaxhighlight>
 +
-- * scenes * --
 
getObject("Scenes[scene_name].SceneConditions[condition_name]") -- get condition linked to a scene
 
getObject("Scenes[scene_name].SceneConditions[condition_name]") -- get condition linked to a scene
 
getObject("Scenes[scene_name].SceneObjects[object_name].ObjectConditions[condition_name]") -- get condition linked to a scene object
 
getObject("Scenes[scene_name].SceneObjects[object_name].ObjectConditions[condition_name]") -- get condition linked to a scene object
 +
getObject("Scenes[scene_name].SceneValues[value_name]") -- get value linked to a scene
 +
getObject("Scenes[scene_name].SceneObjects[object_name].ObjectValues[value_name]") -- get value linked to a scene object
 +
getObject("Scenes[scene_name].SceneActions[action_name]") --
 +
getObject("scenes[scene_name].SceneObjects[object_name].ObjectAnimations[animation_name]") -- get animation linked to a scene object
 +
-- * characters * --
 +
getObject("Characters[character_name].CharacterConditions[condition_name]") -- get condition linked to a character
 +
getObject("Characters[character_name].CharacterValues[value_name]") -- get value linked to a character
 +
getObject("Characters[character_name].CharacterActions[action_name]") -- get action linked to a character
 +
getObject("Characters[character_name].CharacterOutfits[outfit_name].OutfitCharacterAnimations[animation_name]") -- get animation linked to a character
 +
-- etc...
 
</syntaxhighlight>
 
</syntaxhighlight>
  
-- let's check if the stored cursor position equals another x,y value!
 
if curPos.x == 200 and curPos.y == 400 then
 
-- do some action!
 
else
 
-- do some other action!
 
end
 
</syntaxhighlight>
 
  
  
 +
<span class="bold underline">Arguments</span>
  
<span class="bold underline">Arguments</span>
+
'''path''': "string" <br/>
 +
The path to the required data structure object.
 +
 
 +
'''object''': text<br/>
 +
Name of the object, character, condition etc; the name is case sensitive.
  
none
+
'''error''': bool (true/false) <br/>
 +
If <span class="green">''true''</span> a warning will be printed to the log, if the linked object can not be found; it is set to <span class="green">true</span>, by default.
  
  
Line 55: Line 67:
 
<span class="bold underline">Return</span>
 
<span class="bold underline">Return</span>
  
<span class="bold">pos</span> <br/>
+
'''object''' <br/>
Table containing x,y values of current mouse cursor position
+
Returns the data from the linked objects table; or returns empty.
{{i18n|GetCursorPos_(CMS)}} <br/>
 
{| class="tbl-ds"
 
|-
 
|<span class="bold">Relevant Pages</span>: [[SetCursorPos_(CMS)|setCursorPos]]
 
|}
 

Revision as of 20:58, 31 August 2014

Function history
Available since v3.0

Allows you to access, read & manipulate the data tables for the linked object, item, character, condition, & value etc...

Additional Info
!important: The object names are case sensitive.


Syntax:

getObject("path[object, error]")


Example 1: Quick getObject method; you must take care when using this method, that your project does not contain multiple objects with the same name.

-- This method is unsafe because it accesses all the condition/value tables associated with the project
getObject("Conditions[condition_name]") -- get a condition
getObject("Values[value_name]") -- get a value
getObject("Actions[action_name]") -- get an action
getObject("Animations[animation_name]") -- get an animation

Example 2: Full getObject method.

-- * scenes * --
getObject("Scenes[scene_name].SceneConditions[condition_name]") -- get condition linked to a scene
getObject("Scenes[scene_name].SceneObjects[object_name].ObjectConditions[condition_name]") -- get condition linked to a scene object
getObject("Scenes[scene_name].SceneValues[value_name]") -- get value linked to a scene
getObject("Scenes[scene_name].SceneObjects[object_name].ObjectValues[value_name]") -- get value linked to a scene object
getObject("Scenes[scene_name].SceneActions[action_name]") -- 
getObject("scenes[scene_name].SceneObjects[object_name].ObjectAnimations[animation_name]") -- get animation linked to a scene object
-- * characters * --
getObject("Characters[character_name].CharacterConditions[condition_name]") -- get condition linked to a character
getObject("Characters[character_name].CharacterValues[value_name]") -- get value linked to a character
getObject("Characters[character_name].CharacterActions[action_name]") -- get action linked to a character
getObject("Characters[character_name].CharacterOutfits[outfit_name].OutfitCharacterAnimations[animation_name]") -- get animation linked to a character
-- etc...


Arguments

path: "string"
The path to the required data structure object.

object: text
Name of the object, character, condition etc; the name is case sensitive.

error: bool (true/false)
If true a warning will be printed to the log, if the linked object can not be found; it is set to true, by default.


Flags

none


Return

object
Returns the data from the linked objects table; or returns empty.