Character

Class for representing a Character.
 npc1 = am.character.new("npc1")
 npc1:name("Fredrick Smith")
 
 game = am.engine.get_game()
 main = game:main()
Return to Index
static new ( string game_id = "" )
static new ( string game_id = "" , string def_name )
__gc ( )
__eq ( am.character rhs ) -> ( boolean )
static from_def ( string def_name , string game_id = "" ) -> ( am.character )
name ( ) -> ( string )
name ( string name ) -> ( am.character )
description ( ) -> ( string )
description ( string description ) -> ( am.character )
pickup_reach ( ) -> ( number )
pickup_reach ( number radius ) -> ( am.character )
stats ( ) -> ( am.stats )
add_body_part ( am.body_part part ) -> ( boolean )
add_body_part ( string part_name , string part_type = UNKNOWN_PART ) -> ( boolean )
remove_body_part ( am.body_part part ) -> ( boolean )
remove_body_part ( string part_name ) -> ( boolean )
has_body_part ( am.body_part part ) -> ( boolean )
has_body_part ( string part_name ) -> ( boolean )
body_parts ( ) -> ( table )
equip_item ( am.item item , am.body_part part ) -> ( boolean )
equip_item ( am.item item , string part_name ) -> ( boolean )
unequip_item ( am.body_part part ) -> ( boolean )
unequip_item ( string part_name ) -> ( boolean )
equipped ( string part_name ) -> ( am.item )
inventory ( ) -> ( am.inventory )
pickup_item ( am.item item ) -> ( am.code )
add_item ( am.item item ) -> ( boolean )
remove_item ( am.item item ) -> ( boolean )
has_item ( am.item item ) -> ( boolean )
drop_item ( am.item item ) -> ( integer )
drop_item ( am.item item , number x , number y ) -> ( integer )
age ( ) -> ( number )
age ( number age ) -> ( am.character )
race ( ) -> ( Race )
race ( string race_name ) -> ( am.character )
race ( Race race ) -> ( am.character )
gender ( ) -> ( string )
gender ( string gender ) -> ( am.character )
coin_purse ( ) -> ( am.coin_purse )
graphic ( ) -> ( am.sprite )
graphic ( string asset_name ) -> ( am.character )
graphic ( am.sprite sprite ) -> ( am.character )
destination ( ) -> ( number , number )
destination ( number x , number y ) -> ( am.character )
grid_destination ( ) -> ( integer , integer )
grid_destination ( integer x , integer y ) -> ( am.character )
destination_length ( ) -> ( number )
has_destination ( ) -> ( boolean )
location ( ) -> ( number , number )
location ( number x , number y ) -> ( am.character )
grid_location ( ) -> ( integer , integer )
grid_location ( integer x , integer y ) -> ( am.character )
move ( number x , number y ) -> ( am.character )
move_grid ( integer x , integer y ) -> ( am.character )
talk_to ( string id ) -> ( boolean )
talk_to ( am.game_object talkee ) -> ( boolean )
fixed_to_grid ( ) -> ( boolean )
fixed_to_grid ( boolean fixed ) -> ( am.character )
map ( ) -> ( am.map )
map ( am.map map ) -> ( am.character )
original_map ( ) -> ( am.map )
original_map ( am.map map ) -> ( am.character )
add_passible_type ( am.tile_type tile_type ) -> ( am.character )
add_passible_type ( string tile_type_name ) -> ( am.character )
remove_passible_type ( am.tile_type tile_type ) -> ( am.character )
remove_all_passible_types ( ) -> ( am.character )
has_passible_type ( am.tile_type tile_type ) -> ( boolean )
get_passible_types ( ) -> ( table )
game_id ( ) -> ( string )
game_id ( string game_id ) -> ( boolean )
static find ( string game_id ) -> ( am.character )
dialogue_component ( ) -> ( am.dialogue_component )
dialogue_component ( am.dialogue_component comp , boolean set_attached = true ) -> ( )
on ( string event_type , function listener , table content = nil ) -> ( boolean )
off ( string event_type , function listener , table context = nil ) -> ( boolean )
has_event_listener ( string event_type ) -> ( boolean )
experience ( ) -> ( integer )
experience ( integer experience ) -> ( am.character )
add_experience ( integer experience ) -> ( am.character )
level ( ) -> ( integer )
level ( integer level ) -> ( am.character )
add_level ( integer levels ) -> ( am.character )
max_level ( ) -> ( integer )
max_level ( integer max_level ) -> ( am.character )
ai_func ( ) -> ( function )
ai_func ( function func ) -> ( am.character )
interact_with ( ) -> ( function )
interact_with ( function func ) -> ( am.character )
interact_dialogue ( am.game_object interacter , bool by_movement ) -> ( am.code )
attrs ( boolean create_table = false ) -> ( DataTable )
attrs ( am.data_table attr_table ) -> ( am.character )
static new ( string game_id = "" )
Creates or wraps a character instance. For example, the first time a character is created (as in the case of a new game) there should not be any existing character with the same game_id. In which case a new character will be created. If the character was not pre-existing then it will need all the specific values set onto it. However if it was pre-existing then you are unlikely to want to set it's current values back to what they were when the character was first created. However event listeners are not maintained between saves, so they will have to be added to an existing (loaded) character as well as a new one.
Parameters:
string game_id = "" : The game id to create the character with or the game id of an existing character.
Returns:
am.character : The newly created character or returns an existing character with the same game_id.
boolean : True if the character was newly created or false if it already existed.
static new ( string game_id = "" , string def_name )
Behaves the same as the base constructor however the new character will be created from the given character definition if it has to be created.
Parameters:
string game_id = "" : The game id to create the character with or the game id of an existing character.
string def_name : The character definition name to look up when creating the character if it one did not exist.
Returns:
am.character : The newly created character or returns an existing character with the same game_id.
boolean : True if the character was newly created or false if it already existed.
__gc ( )
Releases the reference of this character.
__eq ( am.character rhs ) -> ( boolean )
Compares this character with another character reference. Will not return true for equivalent characters.
Parameters:
am.character rhs : The other character to compare with.
Returns:
boolean : True if the characters are the same entity.
static from_def ( string def_name , string game_id = "" ) -> ( am.character )
Creates a new character from the character definition. Character definitions are automatically loaded if one with the given name is not registered.

Example (a test map Lua file):

 npc = am.character.from_def("npcs:male1")
 if (npc ~= nil)
     npc:name("Fred")
 end

In "data/defs/npcs.lua":

 game = am.engine.game()
 
 npc = am.character.new()
 npc:age(21):gender("male"):graphic(am.sprite.new("characters/npc/front"))
 
 -- Here the npc is registered with the name "male1" and "npcs:" will 
 -- automatically be prepended because of the filename.
 game:char_def("male1", npc)
Parameters:
string def_name : The name of the character definition.
string game_id = "" : The game id to give to the newly created character.
Returns:
am.character : A copy of the character from the given definition, or nil if no definition was found.
name ( ) -> ( string )
Returns the name of the character. A nil return indicates that there was an error.
Returns:
string : The name of the character.
name ( string name ) -> ( am.character )
Sets the name of the character.
Parameters:
string name : The name to set the character.
Returns:
am.character : This.
description ( ) -> ( string )
Returns the description of the character. A nil return indicates that there was an error.
Returns:
string : The description of the character.
description ( string description ) -> ( am.character )
Sets the description of the character.
Parameters:
string description : The description to set the character.
Returns:
am.character : This.
pickup_reach ( ) -> ( number )
Returns the pickup reach of the character. The pickup reach is the radius around the character in grid units in which the character is able to pickup items and interact with objects.
Returns:
number : The pickup reach radius.
pickup_reach ( number radius ) -> ( am.character )
Sets the pickup reach radius for the character. The pickup reach is the radius around the character in grid units in which the character is able to pickup items and interact with objects.
Parameters:
number radius : The pickup reach radius.
Returns:
am.character : This.
stats ( ) -> ( am.stats )
Returns the stats container linked with this character.
Returns:
am.stats : The stats container.
add_body_part ( am.body_part part ) -> ( boolean )
Attempts to add a body part to the character. Returns true if this was successful, false if there was another body part with the same name attached.
Parameters:
am.body_part part : The body part to add
Returns:
boolean : If part was added successfully.
add_body_part ( string part_name , string part_type = UNKNOWN_PART ) -> ( boolean )
Attempts to add a body part with the given name to the character. Returns true if this was successful, false if there was another body part with the same name attached.
Parameters:
string part_name : The name of the body part to create and add to the character.
string part_type = UNKNOWN_PART : The type of the body part.
Returns:
boolean : If part was added successfully.
remove_body_part ( am.body_part part ) -> ( boolean )
Removes a body part with the same name from the character.
Parameters:
am.body_part part : The body part to remove.
Returns:
boolean : True if the body part was removed.
remove_body_part ( string part_name ) -> ( boolean )
Removes a body part with the same name from the character.
Parameters:
string part_name : The body part to remove.
Returns:
boolean : True if the body part was removed.
has_body_part ( am.body_part part ) -> ( boolean )
Tells if a body part with the same name is attached to the character.
Parameters:
am.body_part part : The body part to check for.
Returns:
boolean : True if the body part is attached.
has_body_part ( string part_name ) -> ( boolean )
Tells if a body part with the same name is attached to the character.
Parameters:
string part_name : The body part to check for.
Returns:
boolean : True if the body part is attached.
body_parts ( ) -> ( table )
Returns a table of all the body parts attached to this character. Returns nil if there was an error. Each table entry is a key/value pair with the key being the body parts name.
Returns:
table : A table of all the body parts.
equip_item ( am.item item , am.body_part part ) -> ( boolean )
Equips an item to the character on the given body part.
Parameters:
am.item item : The item to equip, it cannot be nil.
am.body_part part : The body part to equip the item to.
Returns:
boolean : True if the item was successfully equipped, false can mean that there was already an item equipped, 'part' was nil, or 'part' was not an attached body part.
equip_item ( am.item item , string part_name ) -> ( boolean )
Equips an item to the character on the given body part.
Parameters:
am.item item : The item to equip, it cannot be nil.
string part_name : The body part to equip the item to.
Returns:
boolean : True if the item was successfully equipped, false can mean that there was already an item equipped, or 'part_name' was not an attached body part.
unequip_item ( am.body_part part ) -> ( boolean )
Unequips the item on the given body part for this character.
Parameters:
am.body_part part : The body part to unequip the item from.
Returns:
boolean : True if the item was unequipped or if the body part was already empty. False can mean 'part' was nil or that 'part' was not an attached body part.
unequip_item ( string part_name ) -> ( boolean )
Unequips the item on the given body part for this character.
Parameters:
string part_name : The body part to unequip the item from.
Returns:
boolean : True if the item was unequipped or if the body part was already empty. False can mean that 'part_name' was not an attached body part.
equipped ( string part_name ) -> ( am.item )
Returns the item equipped at the given body part.
Parameters:
string part_name : The body part to get the item from.
Returns:
am.item : The item equipped, nil if there was no item equipped or if there was not body part with 'part_name' found.
inventory ( ) -> ( am.inventory )
Returns the inventory object attached to this character.
Returns:
am.inventory : The attached inventory, nil if there was an error.
pickup_item ( am.item item ) -> ( am.code )
Attempts to pickup an item.
Parameters:
am.item item : The item to attempt to pickup.
Returns:
am.code : Return code for the pickup:
success The item was picked up.
nil_parameter The item was nil.
out_of_range The item was out of range of this characters pickup radius.
not_enough_inventory_space There's not enough space for the item to be picked up.
add_item ( am.item item ) -> ( boolean )
Adds an item to the characters inventory. Returns true if it was successful, false there was not enough space.
Parameters:
am.item item : The item to add.
Returns:
boolean : True for successful add.
remove_item ( am.item item ) -> ( boolean )
Removes an item from the characters inventory. Returns true if the item was removed, false if the item was nil or if the item could not be found.
Parameters:
am.item item : The item to remove.
Returns:
boolean : True if removal was successful.
has_item ( am.item item ) -> ( boolean )
Returns true if an item is in the characters inventory. Returns false if the item was nil or not found.
Parameters:
am.item item : The item to search for.
Returns:
boolean : True if found successfully.
drop_item ( am.item item ) -> ( integer )
Drops an item at the characters feet. Return codes:
  • 1: Success.
  • 0: Item was nil.
  • -1: Drop location was too far away (should not happen).
  • -2: Drop location was invalid for item.
  • -3: Error.
Parameters:
am.item item : The item to drop
Returns:
integer : Drop item return code:
success The item was dropped.
nil_parameter The item was nil.
off_the_map The drop location was off the map.
out_of_range The item was out of range of this characters pickup radius to drop (should not happen).
invalid_location The drop location was invalid for the item.
drop_item ( am.item item , number x , number y ) -> ( integer )
Drops an item at the given map coordinates. Return codes:
  • 1: Success.
  • 0: Item was nil.
  • -1: Drop location was too far away.
  • -2: Drop location was invalid for item.
  • -3: Error.
Parameters:
am.item item : The item to drop
number x : X map location to drop at
number y : Y map location to drop at
Returns:
integer : Drop item return code.
age ( ) -> ( number )
Returns the age of the character.
Returns:
number : The age of the character
age ( number age ) -> ( am.character )
Sets the age of the character.
Parameters:
number age : The new characters age
Returns:
am.character : This.
race ( ) -> ( Race )
Returns the characters Race.
Returns:
Race : The characters Race
race ( string race_name ) -> ( am.character )
Sets the race of the character. If the race could not be found in the game engine, the characters race is unchanged.
Parameters:
string race_name : The name of the race.
Returns:
am.character : This
race ( Race race ) -> ( am.character )
Sets the race of the character, nil will set to the unknown race.
Parameters:
Race race : The race to change to.
Returns:
am.character : This
gender ( ) -> ( string )
Returns the gender of the character.
Returns:
string : The characters gender
gender ( string gender ) -> ( am.character )
Sets the characters gender. Currently only supports "male" and "female", if it is not one of these the characters gender is not changed.
Parameters:
string gender : The gender to change to.
Returns:
am.character : This
coin_purse ( ) -> ( am.coin_purse )
Returns the characters coin purse. This stores all the coin that the character currently holds.
Returns:
am.coin_purse : The characters coin purse.
graphic ( ) -> ( am.sprite )
Returns the graphic attached to this character, can be nil.
Returns:
am.sprite : The characters sprite.
graphic ( string asset_name ) -> ( am.character )
Sets the characters asset graphic. Sets the asset_name of the graphic for this character.
Parameters:
string asset_name : The asset name to the graphic.
Returns:
am.character : This
graphic ( am.sprite sprite ) -> ( am.character )
Sets the characters graphic, can be nil.
Parameters:
am.sprite sprite : The graphic to set.
Returns:
am.character : This
destination ( ) -> ( number , number )
Returns the characters current destination in world units.
Returns:
number : The x world unit.
number : The y world unit.
destination ( number x , number y ) -> ( am.character )
Sets the characters destination in world units (not by grid coordinates).
Parameters:
number x : The x world unit.
number y : The y world unit.
Returns:
am.character : This
grid_destination ( ) -> ( integer , integer )
Returns the characters current destination in grid coordinates.
Returns:
integer : The x grid coordinate.
integer : The y grid coordinate.
grid_destination ( integer x , integer y ) -> ( am.character )
Sets the characters destination in grid coordinates.
Parameters:
integer x : The x grid coordinate.
integer y : The y grid coordinate.
Returns:
am.character : This
destination_length ( ) -> ( number )
If this character has a destination, this returns how long the path is to the destination from the characters current location in world units.
Returns:
number : The length of the characters current path.
has_destination ( ) -> ( boolean )
Returns true if this character has a destination. This will be false if one has not been set or if the character is at their destination.
Returns:
boolean : True if the character has somewhere it wants to go.
location ( ) -> ( number , number )
Returns the characters current map location.
Returns:
number : The characters x map value
number : The characters y map value
location ( number x , number y ) -> ( am.character )
Sets the characters map location.
Parameters:
number x : The x map value
number y : The y map value
Returns:
am.character : This
grid_location ( ) -> ( integer , integer )
Returns the characters currnet map grid location.
Returns:
integer : x The x grid value
integer : y The y grid value
grid_location ( integer x , integer y ) -> ( am.character )
Sets the characters current map grid location.
Parameters:
integer x : The x grid value
integer y : The y grid value
Returns:
am.character : This
move ( number x , number y ) -> ( am.character )
Moves a character by {x, y} amount. If the new location isn't valid, the character isn't moved.
Parameters:
number x : The x amount to move by
number y : The y amount to move by
Returns:
am.character : This
move_grid ( integer x , integer y ) -> ( am.character )
Moves a character by {x, y} grid amounts. If the new location isn't valid, the character isn't moved.
Parameters:
integer x : The x grid amount to by move by
integer y : The y grid amount to by move by
Returns:
am.character : This
talk_to ( string id ) -> ( boolean )
Initiates a conversation between this character and the game object id passed in. Returns true if the conversation was initiated. False can mean that the game object id was invalid or that either this character or the game object did not have a dialog component attached.
Parameters:
string id : The game object id.
Returns:
boolean : True if the conversation was initiated.
talk_to ( am.game_object talkee ) -> ( boolean )
Initiates a conversation between this character and the game object passed in. Returns true if the conversation was initiated. False can mean that the game object was nil or that either this character or the game object did not have a dialog component attached.
Parameters:
am.game_object talkee : The game object to start a converstation with.
Returns:
boolean : True if the conversation was initiated.
fixed_to_grid ( ) -> ( boolean )
Returns true if this character is fixed to the game grid or false if the character is able to move freely about the map.
Returns:
boolean : True if the character is fixed to the grid.
fixed_to_grid ( boolean fixed ) -> ( am.character )
Sets if the character is fixed to the grid or not. If a character is fixed to the grid, they cannot move to positions other than the center of each grid space.
Parameters:
boolean fixed : Sets the fixed to grid value.
Returns:
am.character : This
map ( ) -> ( am.map )
Returns the current map that this character is on, can be nil.
Returns:
am.map : The map the character is on.
map ( am.map map ) -> ( am.character )
Sets the map that the character is on, can be nil.
Parameters:
am.map map : The map to put the character on.
Returns:
am.character : This
original_map ( ) -> ( am.map )
Returns the original map that this character was on, can be nil.
Returns:
am.map : The map the character was originally on.
original_map ( am.map map ) -> ( am.character )
Sets the map that the character was originally on, can be nil. This is usually set automatically the first time a character is added to a map. This is primarily used for reloading the character and knowing where to find likely find any event handlers and additional information relating to the character that is not stored directly on the character.
Parameters:
am.map map : The map the character was originally was on.
Returns:
am.character : This
add_passible_type ( am.tile_type tile_type ) -> ( am.character )
Adds a tile type to the list of tile types that this character can move freely on. TileTypes can be added multiple times.
Parameters:
am.tile_type tile_type : The type to add to the list.
Returns:
am.character : This
add_passible_type ( string tile_type_name ) -> ( am.character )
Adds a tile type to the list of tile types that this character can move freely on. Tile types can be added multiple times.
Parameters:
string tile_type_name : The name of the type to add to the list.
Returns:
am.character : This
remove_passible_type ( am.tile_type tile_type ) -> ( am.character )
Removes a tile type from the list of passible tiles.
Parameters:
am.tile_type tile_type : The tile type to remove.
Returns:
am.character : This
remove_all_passible_types ( ) -> ( am.character )
Removes all tile types from this characters passible list.
Returns:
am.character : This
has_passible_type ( am.tile_type tile_type ) -> ( boolean )
Returns true if the given tile type is found on this characters passible list.
Parameters:
am.tile_type tile_type : The tile type to search for
Returns:
boolean : True if the tile type is found
get_passible_types ( ) -> ( table )
Returns a table of all the passible tile types for this character.
Returns:
table : Table of all the tile types.
game_id ( ) -> ( string )
Returns the game id for this character.
Returns:
string : The characters game id.
game_id ( string game_id ) -> ( boolean )
Sets the characters game id, this is used to refer to this character from the game engine. Should be unique.
Parameters:
string game_id : The characters unique game id.
Returns:
boolean : True if the game id change was successful or if game id was the same as the given game_id. False indicates that either there is no current game engine or there is another game object with the same game id.
static find ( string game_id ) -> ( am.character )
Looks for a character with the given game id. Nil is returned if it is not found.
Parameters:
string game_id : The game id to look up
Returns:
am.character : The found character or nil
dialogue_component ( ) -> ( am.dialogue_component )
Returns the dialogue component attached to this character, can be nil.
Returns:
am.dialogue_component : The attached dialogue component
dialogue_component ( am.dialogue_component comp , boolean set_attached = true ) -> ( )
Sets a dialogue component onto this character, can be nil.
Parameters:
am.dialogue_component comp : The dialogue component to attach to this character, can be nil.
boolean set_attached = true : When true it also sets that this character is the game object attached to the dialogue component.
on ( string event_type , function listener , table content = nil ) -> ( boolean )
Adds an event listener for an event fired on this character. eg:
 character:on("talkTo", function(event)
     am_log("Character talked to")
 end)
Parameters:
string event_type : The event type or name to trigger on
function listener : The function to call when the event is fired.
table content = nil : An option context for the listener to be called with.
Returns:
boolean : True if the event was added successfully.
off ( string event_type , function listener , table context = nil ) -> ( boolean )
Removes an event listener from this character. eg:
 function talkToOnce(event)
     am_log("Character talked to once")
     character:off("talkTo", talkToOnce)
 end
 character:on("talkTo", talkToOnce)
Parameters:
string event_type : The event type the listener was listening for.
function listener : The listener function to remove.
table context = nil : The context which the listener was going to be called with, this is only optional if the listener was added with no context.
Returns:
boolean : True if the event listener was successfully removed.
has_event_listener ( string event_type ) -> ( boolean )
Returns true when there is an event listener for the given event_type.
Parameters:
string event_type : The event type to look up.
Returns:
boolean : True if there is any event listener that will be trigged by this event type.
experience ( ) -> ( integer )
Returns the amount of experience this character has.
Returns:
integer : The amount of experience this character has.
experience ( integer experience ) -> ( am.character )
Sets the amount of experience this character has. If the amount of experience is enough to level up the character, they will be leveled up to the appropriate level. A characters level cannot go down again, even if their experience is too low for their current level. If the character has a max level and the experience is more than the characters max level experience, it will be capped at that amount. It is generally recommended to simply add experience to a character.
Parameters:
integer experience : The amount of experience to set on this character.
Returns:
am.character : This
add_experience ( integer experience ) -> ( am.character )
Adds the given amount of experience to the total amount of experience this character has. The total will always be capped at the characters max level if they have one.
Parameters:
integer experience : The amount of experience to add.
Returns:
am.character : This
level ( ) -> ( integer )
Returns the characters current level.
Returns:
integer : The characters level
level ( integer level ) -> ( am.character )
Sets the characters level. If the new level is higher than the characters current level, their experience is also set at the amount required to be that level. However a characters level cannot be set lower than what it currently is. The level cannot be set higher than a characters max level if they have a max level set. It is generally recommended to use add_level instead of setting it directly.
Parameters:
integer level : The characters new level.
Returns:
am.character : This
add_level ( integer levels ) -> ( am.character )
Adds the given amount of levels to this character. This new level will not go over a characters max level if they have one set. The characters experience will also be set the appropriate amount for them to be this level.
Parameters:
integer levels : The number of levels to add to this character
Returns:
am.character : This
max_level ( ) -> ( integer )
Returns this characters maximum level that they can achieve. If max level is set to 0, their effective max level will be 2^15 (32768).
Returns:
integer : The characters current max level.
max_level ( integer max_level ) -> ( am.character )
Sets the characters max level. If the max level is set to 0, then their effective max level will be 2^15 (32768).
Parameters:
integer max_level : The characters max level.
Returns:
am.character : This
ai_func ( ) -> ( function )
Returns the function used by the AI to run.
Returns:
function : The AI function, can be nil.
ai_func ( function func ) -> ( am.character )
Sets the AI function, the function takes 2 parameters, the character currently being processed and the current delta time. The function can be set to nil for default behaviour.
Parameters:
function func : The new AI function.
Returns:
am.character : This
interact_with ( ) -> ( function )
Returns the interacting with function, returns nil if no Lua function was set.
Returns:
function : The interact with function.
interact_with ( function func ) -> ( am.character )
Sets the interact with function. This can be used to override the default interaction behaviour. If this function does not specify that it the game object was interacted with, then the default behaviour is executed.
Parameters:
function func : The new interact with functionality.
Returns:
am.character : This
interact_dialogue ( am.game_object interacter , bool by_movement ) -> ( am.code )
Executes dialogue interactions with the object. This can be used during an interact with function callback to start dialogue. This will work with any game object, unless it does not have a dialogue component.
Parameters:
am.game_object interacter : The game object that initiated the interaction.
bool by_movement : Flag that indicates if the interaction started because of movement or because of other reasons, such as mouse input.
Returns:
am.code : Standard interaction results:
did_interact Interaction occured, perform no further actions.
did_not_interact Interaction did not occur, can perform further actions.
do_not_interact Interaction did not occur, but do not perform any further actions.
attrs ( boolean create_table = false ) -> ( DataTable )
Returns the characters attribute data table. By default if no attribute data table is present nil is returned unless true is passed as the first argument, then a data table is created if one is not present.
Parameters:
boolean create_table = false : Create a data table if one didn't exist.
Returns:
DataTable : The data table on this character.
attrs ( am.data_table attr_table ) -> ( am.character )
Sets the data table on this character, can be set to nil.
Parameters:
am.data_table attr_table : The data table to set on the character.
Returns:
am.character : This