Aw teleport

From ActiveWiki
Jump to navigation Jump to search


Minimum requirements
Added in version 3.0
SDKbuild 16
Worldbuild 23


int aw_teleport (int session_id)

Description

Moves a user to a new location.

Callback

None (returns immediately)

Notes

This method is primarily intended to allow bots to teleport human users around in a world. Since it is up to the receiving application to act on the teleport, it will usually not have any effect when directed at other bots unless those bots have been explicitly programmed to respond to the AW_EVENT_TELEPORT event.

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

Arguments

session_id
Session number of user to teleport.

Argument attributes

AW_TELEPORT_WORLD
Users can be teleport to another world by setting the AW_TELEPORT_WORLD attribute. Set this attribute to "" for teleports within the same world. Users cannot be "warped" to another world.
AW_TELEPORT_X
AW_TELEPORT_Y
AW_TELEPORT_Z
AW_TELEPORT_YAW
AW_TELEPORT_WARP
If set to 1 (true) then the user is "warped" smoothly to the new location (in the same manner as object action warp command). Otherwise, the user is teleported instantly.

Return values

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

Returned attributes

None

Usage

/* teleport a user to Ground Zero */
void send_to_gz (int session)
{
  aw_int_set (AW_TELEPORT_X, 0);
  aw_int_set (AW_TELEPORT_Y, 0);
  aw_int_set (AW_TELEPORT_Z, 0);
  aw_int_set (AW_TELEPORT_YAW, 0);
  aw_string_set (AW_TELEPORT_WORLD, "");
  aw_bool_set (AW_TELEPORT_WARP, 0);
  
  if (aw_teleport (session) != RC_SUCCESS)
    printf ("Unable to teleport session %d\n", session);
  else
    printf ("Session %d teleported to 0N 0W\n", session);
}

See also