Room variables

From EsWiki

Jump to: navigation, search

Room Variables are name/value pairs stored on the server and scoped to a room. These variables are seen by users in that room and are accessible by server extensions. Room variables can be created during the room creation process, by users in the room, or by server extensions. The value of a room variable is an EsObject.

When a user joins a room that user specifies if they want to receive Room Variable Update Events. The default is to receive these events. All users that have indicated they want to receive these events are given the list of room variables when they enter and receive events when a room variable is added, updated, or deleted.

Contents

Why Are Room Variables Useful?

Room Variables provide a convenient way for developers to accomplish simple things easily. For instance, Room Variables can be set in a room to specify the background music to play, the chat skin to use, etc.

Creating a Room Variable

When a client creates a room variable the following are specified:

  • Room Id (integer) – The id of the room in which to create the Room Variable.
  • Zone Id (integer) – The id of the zone that owns the room.
  • Name (string) – The name of the Room Variable.
  • Value (EsObject) – The EsObject value of the Room Variable.
  • Locked (Boolean) – If true then the variable cannot be modified until it is unlocked. If false then the variable value can be modified.
  • Persistent (Boolean) – If true then when the user that creates the Room Variable leaves the room the variable remains. If false then when the user that created the Room Variable leaves the room the variable is removed.

Updating a Room Variable

A Room Variable can be updated by changing its locked status or by changing its value.

Room Variables and Extensions

A server plugin can create, update, or remove Room Variables with the same capabilities as a client – except for the persistent property. The persistent property can tie the Room Variable to a user.

Plugins can implement a Room Variable event handler so that they can tell when a Room Variable has been modified.

Personal tools
download