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

from_entity, from_category_slug, from_slug

Consumption

where_to_entity, where_to_category_slug, where_to_slug

Ad view

placed_at, placed_at_slug

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

from_entity

The action that causes the player to gain an object

  • An event method is used as a value of from_entity.

  • There is a difference between purchase event methods depending on payment options. If the player purchased an item with in-game currencies, the value of from_entity should be ShopPurchase. If purchasing an item with real money, it should be InAppPurchase.

from_category_slug

The type of acquistion place, source, or situation

from_slug

The place, source, or situation of acquisition

Example code
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

where_to_entity

The purpose for which the player consumes an object

  • An event method is used as a value of where_to_entity.

  • There is a difference between purchase event methods depending on payment options. If the player purchased an item with in-game currencies, the value of from_entity should be ShopPurchase. If purchasing an item with real money, the same should be InAppPurchase.

where_to_category_slug

The type of consumption place or outcome

where_to_slug

The place or outcome of consumption

Example code
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