AW AVATAR STATE

From ActiveWiki
Revision as of 04:23, 26 September 2009 by Macavity (talk | contribs) (Removed hardcoded array length from example)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Minimum requirements
Added in version 3.4
SDKbuild 29
Worldbuild 50
Browserbuild 445


AW_AVATAR_STATE

Type

Integer

Description

State of a users avatar.

Notes

This is the value set for AW_MY_STATE when the user called aw_state_change. Out of bounds values will be reset to AW_AVATAR_STATE_WALKING in a browser.

For SDK build 27, world build 44, browser build 430; and later: It is also used by aw_avatar_set to force users into changing the state of their avatar.

Range

When user is a bot:

Minimum:-2147483648)
Maximum:2147483647)
Default:0 (AW_AVATAR_STATE_WALKING)

When user is a browser version 3.4, build 445 - 448:

Minimum:0 (AW_AVATAR_STATE_WALKING)
Maximum:5 (AW_AVATAR_STATE_JUMPING)
Default:0 (AW_AVATAR_STATE_WALKING)

When user is a browser version 3.4 - 3.6, build 449 - 567:

Minimum:0 (AW_AVATAR_STATE_WALKING)
Maximum:6 (AW_AVATAR_STATE_WARPING)
Default:0 (AW_AVATAR_STATE_WALKING)

Browser version 4.1 and later:

Minimum:0 (AW_AVATAR_STATE_WALKING)
Maximum:11 (AW_AVATAR_STATE_CLIMBING)
Default:0 (AW_AVATAR_STATE_WALKING)
0
AW_AVATAR_STATE_WALKING: Walking or standing still.
1
AW_AVATAR_STATE_RUNNING: Running.
2
AW_AVATAR_STATE_FLYING: Flying or hovering.
3
AW_AVATAR_STATE_SWIMMING: Swimming or floating.
4
AW_AVATAR_STATE_FALLING: Falling down.
5
AW_AVATAR_STATE_JUMPING: Jumping up.
6
AW_AVATAR_STATE_WARPING: Teleport warp.
7
AW_AVATAR_STATE_RIDING: Riding a mover.
8
AW_AVATAR_STATE_SLIDING1: Slope angle is greater than the minimum slope angle and less than half the difference between min and max slope angle. Upper limit = min_slope + ((max_slope - min_slope) / 2).
9
AW_AVATAR_STATE_SLIDING2: Slope angle is less than the maximum slope angle, but greater than half the difference between min and max slope angle.
10
AW_AVATAR_STATE_SLIDING3: Sliding down and the slope angle is higher than the maximum slope angle.
11
AW_AVATAR_STATE_CLIMBING: Slope angle is too steep to walk (greater max-slope angle) and the jump key is hit.

Usage

char* avatar_state[] = {"walking", "running", "flying", "swimming",
                        "falling", "jumping", "warping", "riding",
                        "sliding slowly", "sliding", "sliding quickly",
                        "climbing"};

int avatar_state_len = sizeof (avatar_state) / sizeof (avatar_state[0]);

void handle_avatar_change (void)
{
  int i = aw_int (AW_AVATAR_STATE);
  
  if (i >= 0 || i < avatar_state_len)
    printf ("%s is %s\n",
            aw_string (AW_AVATAR_NAME),
            avatar_state[i]);
  else
    printf ("%s is in an unknown state\n",
            aw_string (AW_AVATAR_NAME));
}

aw_event_set (AW_EVENT_AVATAR_CHANGE, handle_avatar_change);

Used by

See also