TPStashEvent.Record

public int Record(
    string method_name,
    params KeyValuePair<string, object>[] param_pairs
);

Description

TPStashEvent.Record is a method that accepts a TPStashEvent method and its parameters as its arguments.

Here is a code example of the Record method that contains Join and its parameter pair.

Example
TPStashEvent myStashEvent = new TPStashEvent();
KeyValuePair<string, object>[] parameters = new KeyValuePair<string, object>[]
{
    new KeyValuePair<string, object>("player_uuid", "myPlayerID"),
};
myStashEvent.Record("Join", parameters);

It returns 1 for success and -1 for failure. If -1 is returned, you can see the following message in the Unity editor console in TentuPlay debug mode:

TPError||ERROR inserting table_name: exception_error_message

Parameter storage

The parameter storage is a feature available when using Record() that allows you to skip the most frequently used parameters (that is, player_uuid and character_uuid) in TPStashEvent methods under certain conditions.

When calling LoginAsCharacter using Record method, the player_uuidand character_uuid parameter values are stored in the parameter storage in memory. After that, they don’t have to include these two parameters repeatedly even though thery are required when you call other subsequent methods except Join, LoginApp and LoginAsCharacter.

To use the parameter storage correctly, make sure that LoginAsCharacter is called first before other methods (except Join and LoginApp) are called via Record. For the Join, LoginApp, and LoginAsCharacter methods, player_uuid and character_uuid are still required.

  • Use the parameter storage only if absolutely necessary. Because the parameter storage contains the values in memory, it might pose a problem unless handled carefully.

  • Make sure that both player_uuid and character_uuid are assigned valid values. Otherwise, the analysis data is not collected at all or collected incompletely.

  • You can also apply the parameter storage to PlayStage. It, however, takes character_uuids, not character_uuid as a parameter. Thus, if your game enters a stage with multiple characters, you must add character_uuids in the parameter list when calling PlayStage.

About value change in the parameter storage
  • If you want to change the values of player_uuid and character_uuid stored in the parameter storage, call LoginAsCharacter using Record again with new player_uuid and character_uuid values assigned. The existing values will be replaced with new ones.

  • The values in player_uuid and character_uuid cannot be assigned or updated seperately.

  • If you add player_uuid and character_uuid and set values to them when you call a method except LoginAsCharacter using Record while the parameter storage holds data, the specified values are assigned as the parameter values, but it does not affect the data in the parameter storage.

Parameters

Name Description Required

method_name

The name of a method in the TPStashEvent class

The name is case insensitive.

Required

param_pairs

A variable number of parameters consisting of Key-Value pairs

  • If one or more of the required parameters don’t exist, the Record method returns an error (-1).

  • If one or more of the optional parameters are assigned with invalid values, it also returns an error (-1).

Key is the name of a parameter that belongs to the method in the TPStashEvent class.

  • The name is case insensitive.

  • If the same key is used repeatedly in one param_pairs, it will be overwritten by the order of the array.

  • The key is required only if the parameter is required.

Value is the value of the parameter.

  • The data type can be either that of the parameter or string.

  • The value must not be null if the paramter is required.

Data Type
Name Description

String array

A string array that is not an empty array. A string separated by commas (,) is also allowed

Enum

The specified enumeration type of each parameter such as the named constant, the numeric value, or the string representation of the numeric value. Otherwise, it returns an error

Required