Characters (DS): Difference between revisions
From The Official Visionaire Studio: Adventure Game Engine Wiki
Created page with "This page consists of an overview of the fields & tables belonging to the '''character''' data structure table. == CharacterActions == A list of actions belonging to the spec..." |
No edit summary |
||
| Line 2: | Line 2: | ||
== CharacterActions == | == CharacterActions == | ||
A list of actions belonging to the specified character. ''Requires iteration.'' | A list of actions belonging to the specified character. ''Requires iteration or an index value.'' | ||
Example 1: print all actions belonging to Tom using ''for loop'' iteration | |||
<syntaxhighlight> | <syntaxhighlight> | ||
local c_act = getObject("Characters[Tom]"):getLinks(VCharacterActions) -- store actions table in c_act | local c_act = getObject("Characters[Tom]"):getLinks(VCharacterActions) -- store actions table in c_act | ||
| Line 10: | Line 11: | ||
print( c_act[i] ) -- will print the action associated with the current index value to the log | print( c_act[i] ) -- will print the action associated with the current index value to the log | ||
end | end | ||
</syntaxhighlight> | |||
Example 2: print a specific action belonging to Tom using the shorthand Lua script method. ''Visionaire Studio 4.1 onwards is required for shorthand.'' | |||
<syntaxhighlight> | |||
print( Characters[Tom].CharacterActions[1] ) -- print action in table index 1 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 19:54, 18 January 2015
This page consists of an overview of the fields & tables belonging to the character data structure table.
CharacterActions
A list of actions belonging to the specified character. Requires iteration or an index value.
Example 1: print all actions belonging to Tom using for loop iteration
local c_act = getObject("Characters[Tom]"):getLinks(VCharacterActions) -- store actions table in c_act
for i = 1, #c_act do -- for index 1 to c_act total value do...
print( c_act[i] ) -- will print the action associated with the current index value to the log
endExample 2: print a specific action belonging to Tom using the shorthand Lua script method. Visionaire Studio 4.1 onwards is required for shorthand.
print( Characters[Tom].CharacterActions[1] ) -- print action in table index 1