Table Of Contents

Previous topic

23.15. The StoreManager Object

Next topic

23.17. The GameProfileManager Object

This Page

23.16. The UserProfile Object

The UserProfile object provides profile information about the current user.

A profile object can be created with the TurbulenzServices.createUserProfile method.

Required scripts

The UserProfile object requires:

/*{{ javascript("jslib/utilities.js") }}*/
/*{{ javascript("jslib/services/turbulenzservices.js") }}*/

23.16.1. Properties

23.16.1.1. username

Summary

String with the username provided by the user. This is a unique name containing only the characters 0-9, A-Z, a-z and hyphen “-”.

Syntax

var name = userProfile.username;

Note

Read Only

23.16.1.2. displayname

Summary

String with the real name provided by the user. This is not unique to the user and can contain any characters.

Note

This is an optional field which the user may not have set. Games should generally use the username to refer to the player.

Syntax

var name = userProfile.displayname;

Note

Read Only

23.16.1.3. age

Summary

Number with the age provided by the user.

Syntax

var age = userProfile.age;
if (age)
{
    // User provided date of birth information
}

Note

Read Only

23.16.1.4. language

Summary

String with the preferred language chosen by the user. It follows the two-letter code standard ISO 639-1.

Syntax

var language = userProfile.language;
if (language)
{
    // User provided preferred language
}

Note

Read Only

23.16.1.5. country

Summary

String with the country of residence provided by the user. It follows the two-letter code standard ISO 3166-1.

Syntax

var country = userProfile.country;
if (country)
{
    // User provided country of residence
}

Note

Read Only

23.16.1.6. guest

Summary

True if the current user is a guest.

Syntax

var guest = userProfile.guest;
if (guest)
{
    // Ask user to create an account to purchase items
}

Note

Read Only

23.16.1.7. anonymous

Summary

True if the current user is an anonymous user. Anonymous users have access to most online functionality (such as UserData, StoreManager), but are unable to use any social features of the engine such as Leaderboards or Badges. The anonymous user functionality is intended for mobile platforms to make Turbulenz games behave more like traditional installed apps - it cannot be used from the browser.

Syntax

var anonymous = userProfile.anonymous;
if (anonymous)
{
    // Ask user to upgrade to full account.
    // See TurbulenzServices.upgradeAnonymousUser()

}

Note

Read Only