User variables

From EsWiki

Jump to: navigation, search

In multiplayer games, chats, and other types of interactive applications, it is often useful to attach information to a user that stays with that user at all times. ElectroServer supports that concept through User Variables, User Plugin Variables, User Extension Variables, and User Server Variables.

Contents

User Variables

A User Variable is a name/value pair stored on the server and scoped to a user. A user can have many User Variables. The value of a User Variable is an EsObject. A user can create, update, or delete his own User Variables. Server extensions can create, update, or delete User Variables on any user.

User Variables of a user are seen by other users in the same room. Users in that room can receive User Variable Update events when User Variables are changed. See Joining a Room for more information on configuring the User Variable Update event.

User Plugin Variables

User plugin variables along with the next two are the same except for the scoping. They are not visible to the connected clients. These have a string as the variable name, and any object as the value. User Plugin Variables are scoped to the plugin and associated with the user. So if a room has three plugins, each could have a User Plugin Variable called "score" with different values.

User Extension Variables

User Extension Variables are scoped to an extension and associated with a specific user. An extension can contain many plugins.

User Server Variables

User Server Variables are scoped to the server and associated with a specific user. A common use for a User Server Variable is storing a user ID that would be used to locate database information about that user.

Personal tools
download