Skip to content

Default JS scripts incorrectly using results of room.GetPlayers() #434

@nswalters

Description

@nswalters

Current Behavior:
In the default scripts provided (see 2-guard-hungry.js or 136.js for examples), the pattern listed below is being used. However the room.GetPlayers() call results in an array of pointers to a ScriptActor and not an array of only userIds.

userIds = room.GetPlayers();
for (var i = 0; i < userIds.length; i++) {
  user = GetUser(userIds[i])
}

Expected Behavior:
Instead, the call to GetUser should call the UserId method on the resulting player record.

userIds = room.GetPlayers();
for (var i = 0; i < userIds.length; i++) {
  user = GetUser(userIds[i].UserId());
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions