Method structures
On this page, you’ll learn about the overall structure of a TentuPlay event method.
Describe behaviors in sentence
A TentuPlay method can be constructed using a sentence that describes the player’s behavior to be collected in terms of data in games.
For example, let’s consider the following sentence that depicts who did what, when and where during a game.
-
While player XYZ is taking the role of character ABC,
-
the player used 50 golds to enhance "Sword of Magic,"
-
and 1270 golds were left.
This can be written as follows:
TPStashEvents.UseCurrency(player.UserId, -- Player Id given by Roblox
"ABC", -- Character Id if exists, Else you can send nil
"GOLD",--used GOLD
50,--used 50
1270,--1270 were left
TPStashEvents.Entity.LevelUpEquipment,--used GOLD to level up the equipment
"Sword",--the category of equipment was sword
"Sword of Magic")--the equipment was "Sword of Magic"
Describe contexts
When illustrating a player’s actions in sentences, it is important to describe "where", "how", and "why" the player did something by using event methods wherever possible.
There are three groups of parameters in use depending on contexts as shown in the following table.
Context | Parameters |
---|---|
Acquisition |
|
Consumption |
|
Ad view |
|
Acquistion context
The acquisition parameters are used in contexts where the Get methods are involved such as GetCharacter
, GetPet
, and GetCurrency
. They contain the information about where and from what the player obtains something.
Parameter | Description | ||
---|---|---|---|
|
The action that causes the player to gain an object
|
||
|
The type of acquistion place, source, or situation |
||
|
The place, source, or situation of acquisition |
TPStashEvent.GetEquipment(player.UserId, -- Player Id given by Roblox
"ABC", -- Character Id if exists, Else you can send nil
"Swords of Magic", --got "Swords of Magic"
1, --1
TPStashEvent.Entity.PlayStage,--at stage
"Forest of Secret",--the category of stage was "Forest of Secret"
"Forest of Secret 1-2")--the stage was "Forest of Secret 1-2"
Comsumption context
The compsumption parameters are used in contexts where the Use methods are involved such as UseCurrency
and UseToken
. They contain the information about where and for what the player consumes something.
Parameter | Description | ||
---|---|---|---|
|
The purpose for which the player consumes an object
|
||
|
The type of consumption place or outcome |
||
|
The place or outcome of consumption |
TPStashEvents.UseCurrency(player.UserId, -- Player Id given by Roblox
"ABC", -- Character Id if exists, Else you can send nil
"DIAMOND",--used DIAMOND
50,--used 50
30,--30 were left
TPStashEvents.Entity.ShopPurchase,--used DIAMOND for in-app purchase
"Shop",--the category of the place of purchase is the shop
"GOLD 2000")--bought 2000 gold package at the shop