Aw world attributes change

From ActiveWiki
Revision as of 05:07, 26 October 2008 by Macavity (talk | contribs) (Added in, cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


int aw_world_attributes_change (void)

Description

Changes the world attributes.

Callback

None (returns immediately)

Notes

Even if only one attribute is changed, all attributes (including unchanged ones) are sent to all avatars in a world. This takes a considerable amount of bandwidth, so use this method carefully.

In order to propagate the changes, a successful call to aw_world_attributes_change will immediately trigger the event AW_EVENT_WORLD_ATTRIBUTES in all clients currently connected to the world.

Only world server administration instances or those owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.

Arguments

None

Argument attributes

All attributes prefixed by AW_WORLD that are not read-only can be changed. Here is a list of those read-only attributes:

AW_WORLD_BUILD_CAPABILITY
AW_WORLD_BUILD_NUMBER
AW_WORLD_CARETAKER_CAPABILITY
AW_WORLD_CREATION_TIMESTAMP
AW_WORLD_EJECT_CAPABILITY
AW_WORLD_EMINENT_DOMAIN_CAPABILITY
AW_WORLD_EXPIRATION
AW_WORLD_MAX_USERS
AW_WORLD_OBJECT_COUNT
AW_WORLD_PUBLIC_SPEAKER_CAPABILITY
AW_WORLD_SIZE
AW_WORLD_SPEAK_CAPABILITY
AW_WORLD_TERRAIN_TIMESTAMP

Return values

RC_SUCCESS
RC_NOT_INITALIZED
RC_NO_INSTANCE
RC_NO_CONNECTION
The connection to the world is down.

Returned attributes

None

Usage

Change the backdrop every hour.

int i;
char *backdrop[] = {"day", "sunset", "night", "sunrise"};

i = 0;
do
{
  aw_string_set (AW_WORLD_BACKDROP, backdrop[i]);
  aw_world_attributes_change ();
  i++;
  if (i == (sizeof (backdrop) / sizeof (backdrop[0])) /* i == 4 in this example */
    i = 0; 
}
while (aw_wait (3600000) == RC_SUCCESS);

See also