Aw world attribute get

From ActiveWiki
Revision as of 05:49, 26 October 2008 by Macavity (talk | contribs) (Reason code links in example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Minimum requirements
Added in version 3.1
SDKbuild 18


int aw_world_attribute_get (int attribute, int *read_only, char *value)

Description

Retrieves the value of an individual world attribute.

Callback

None (returns immediately)

Notes

This method was added to make the implementation of a "remote atload" utility easier and is of limited use to the general SDK programmer. In particular, meaningful values for the attribute argument correspond only to entries in a world server attribute dump file and are not otherwise documented; they do not correspond to the various AW_WORLD_ attributes defined within the SDK.

SDK applications that wish to query the values of specific world attributes should continue to do so by using the aw_int, aw_bool, aw_float, and aw_string routines.

Note that there can be "holes" when enumerating the attributes, in which case this method will return RC_INVALID_ATTRIBUTE. This should be ignored and the enumeration should continue with the next attribute.

Arguments

attribute
Attribute id.
read_only
Returns the read-only flag for the attribute. If set to NULL then it will not be returned.
value
Returns the value of the attribute. The size of this buffer should be at least AW_MAX_ATTRIBUTE_LENGTH + 1.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_INVALID_ATTRIBUTE

Returned attributes

None

Usage

Simplistic remote atdump utility.

FILE* fp;
int   rc;
int   i;
int   read_only;
char  string[AW_MAX_ATTRIBUTE_LENGTH + 1];

fp = fopen ("atdump.txt", "w");

for (i = 0; i < 200; i++)
{
  rc = aw_world_attribute_get (i, &read_only, string);
  if (rc == RC_INVALID_ATTRIBUTE)
    continue;
  if (rc != RC_SUCCESS)
    break;
  
  if (read_only)
    continue;
  
  fprintf (fp, "%d %s\n", i, string);
}

fclose (fp);

See also