Aw string set

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 2.1
SDKbuild 13


int aw_string_set (AW_ATTRIBUTE a, char *value)

Description

Sets a string attribute.

Callback

None (returns immediately)

Notes

Most of the string attributes have a maximum length defined by AW_MAX_ATTRIBUTE_LENGTH in Aw.h. This limit is currently 255 characters, or 256 bytes including the null character. There are a few attributes that can be longer than this (e.g. AW_BOTGRAM_TEXT). Their maximum lengths can vary up to 4095 characters (4096 bytes) depending on the attribute (e.g. AW_BOTGRAM_TEXT has a maximum length of 1000 characters).

See SDK Attributes for more information.

Arguments

a
Attribute (defined in Aw.h).
value
String to set. This string can be modified and/or deallocated afterwards as the SDK makes its own internal copy.

Argument attributes

None

Return values

RC_SUCCESS
RC_NOT_INITIALIZED
RC_NO_INSTANCE
RC_READ_ONLY
RC_INVALID_ATTRIBUTE
RC_TYPE_MISMATCH
Not a string attribute.

Returned attributes

None

Usage

int rc;

aw_int_set (AW_OBJECT_TYPE, 0);
aw_int_set (AW_OBJECT_ID, 0);
aw_int_set (AW_OBJECT_NUMBER, aw_random ());
aw_int_set (AW_OBJECT_X, 0);
aw_int_set (AW_OBJECT_Y, 0);
aw_int_set (AW_OBJECT_Z, 0);
aw_int_set (AW_OBJECT_YAW, 0);
aw_int_set (AW_OBJECT_TILT, 0);
aw_int_set (AW_OBJECT_ROLL, 0);
aw_string_set (AW_OBJECT_MODEL, "street1.rwx");
aw_string_set (AW_OBJECT_DESCRIPTION, "Cornerstone");
aw_string_set (AW_OBJECT_ACTION, "create sound xyz.mid");

rc = aw_object_add ();
if (rc != RC_SUCCESS)
  printf ("Unable to add object (reason %d)\n", rc);
else
  puts ("Object added");

See also