Difference between revisions of "Characters (DS)"
(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...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This page consists of an overview of the fields & tables belonging to the '''character''' data structure table. | + | This page consists of an overview of the fields & tables belonging to the '''character''' data structure table. ''Please note that Visionaire Studio 4.1+ is required for all shorthand Lua script examples.'' |
== 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.'' |
+ | Why would you want to access this? Well... as a quick example: I used this for checking if specific actions were available, which were then used to determine which command buttons should be available in a ring/coin interface I created. ''Please see this script [[Global_Command_Checker_(CMS)|here]].'' | ||
+ | |||
+ | |||
+ | ''Print all actions associated with the character by iterating with the for loop.'' | ||
<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 11: | Line 15: | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
+ | ''Print a single action to log by specifying an index value. | ||
+ | <syntaxhighlight> | ||
+ | print( Characters["Tom"].CharacterActions[1] ) -- print action in table index 1 (shorthand) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | == CharacterActionDestPosition == | ||
+ | If this position is set and an action is executed on this character then the current character walks to this position (instead of directly to the character) to execute the action. | ||
+ | |||
+ | |||
+ | ''Get character action destination position''. | ||
+ | <syntaxhighlight> | ||
+ | getObject("Characters[Tom]"):getPoint(VCharacterActionDestPosition) -- longhand method | ||
+ | Characters["Tom"].ActionDestPosition -- shorthand method | ||
+ | |||
+ | -- * print the x & y coordinate values of the "Character Action Destination Position" to the log file * -- | ||
+ | local c_dest = getObject("Characters[Tom]"):getPoint(VCharacterActionDestPosition) -- store the x,y coordinates into a variable | ||
+ | print( c_dest.x, c_dest.y ) -- print the x,y fields associated with the table we stored in the variable above | ||
+ | |||
+ | -- * same again but with the shorthand method * -- | ||
+ | print( Characters["Tom"].ActionDestPosition.x, Characters["Tom"].ActionDestPosition.y ) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | ''Update the character action destination position.'' | ||
+ | <syntaxhighlight> | ||
+ | getObject("Characters[Tom]"):setValue(VCharacterActionDestPosition, {x = 100, y = 100}) -- longhand method | ||
+ | Characters["Tom"].ActionDestPosition = {x = 100, y = 100} -- shorthand method | ||
+ | </syntaxhighlight> | ||
+ | {{toc}} |
Latest revision as of 20:38, 18 January 2015
This page consists of an overview of the fields & tables belonging to the character data structure table. Please note that Visionaire Studio 4.1+ is required for all shorthand Lua script examples.
CharacterActions
A list of actions belonging to the specified character. Requires iteration or an index value.
Why would you want to access this? Well... as a quick example: I used this for checking if specific actions were available, which were then used to determine which command buttons should be available in a ring/coin interface I created. Please see this script here.
Print all actions associated with the character by iterating with the for loop.
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
end
Print a single action to log by specifying an index value.
print( Characters["Tom"].CharacterActions[1] ) -- print action in table index 1 (shorthand)
CharacterActionDestPosition
If this position is set and an action is executed on this character then the current character walks to this position (instead of directly to the character) to execute the action.
Get character action destination position.
getObject("Characters[Tom]"):getPoint(VCharacterActionDestPosition) -- longhand method
Characters["Tom"].ActionDestPosition -- shorthand method
-- * print the x & y coordinate values of the "Character Action Destination Position" to the log file * --
local c_dest = getObject("Characters[Tom]"):getPoint(VCharacterActionDestPosition) -- store the x,y coordinates into a variable
print( c_dest.x, c_dest.y ) -- print the x,y fields associated with the table we stored in the variable above
-- * same again but with the shorthand method * --
print( Characters["Tom"].ActionDestPosition.x, Characters["Tom"].ActionDestPosition.y )
Update the character action destination position.
getObject("Characters[Tom]"):setValue(VCharacterActionDestPosition, {x = 100, y = 100}) -- longhand method
Characters["Tom"].ActionDestPosition = {x = 100, y = 100} -- shorthand method