| name$ (optional) - the name other players see; "Bot 1", "Bot 2" and so on (default) |
|
Adds a bot to a server room and returns its player ID. A bot is a player with no connection: it is in the roster on every copy, counts toward the room's 128 players, and SharedPlayerBot tells it apart. You drive it with SetSharedBotStick and SetSharedBotButton, and read it back with SharedStickX and the rest, so the code that moves people's entities moves bots' too. Bots run on the server, so they add no traffic. Like a person joining, a bot brings a SHARED_EVENT_PLAYER_JOINED event on every copy, the server included: give it an entity with SetSharedPlayerEntity when you get it. Only a server room's server can add bots. It returns 0 when the room is full or there is no server room, and SharedWorldError() says why. For the full story - server rooms, hosting, sharing and host migration - see the Shared World guide and its complete Shared_World_Playground.bb sample. See also: RemoveSharedBot, SharedPlayerBot, SetSharedBotStick, SetSharedPlayerEntity, SharedPlayerCount. |