KBEngine Module
The KBEngine module provides access to parts of Entity at the logic script layer, as well as data of the current space, etc.
Member Functions
def login( username, password ):
def createAccount( username, password ):
def reloginBaseapp():
def player( ):
def resetPassword(username):
def bindAccountEmail( emailaddress ):
def newPassword( oldpassword, newpassword ):
def findEntity( entityID ):
def getSpaceData( key ):
Properties
entity_uuid uint64
entity_id int32
spaceID int32
Member Function Documentation
def login( username, password ):
Description:
Login to the KBEngine server.
Note: If the plugin and UI layer use event interaction mode, do not call this directly in the UI layer. Please trigger a "login" event to the plugin, with username and password as event data.
Parameters:
username
: string, username.
password
: string, password.
def createAccount( username, password ):
Description:
Request to create a login account on the KBEngine server.
Note: If the plugin and UI layer use event interaction mode, do not call this directly in the UI layer. Please trigger a "createAccount" event to the plugin, with username and password as event data.
Parameters:
username
: string, username.
password
: string, password.
def reloginBaseapp( ):
Description:
Request to re-login to the KBEngine server (usually used after disconnection to reconnect to the server and continue controlling the server character in a timely manner).
Note: If the plugin and UI layer use event interaction mode, do not call this directly in the UI layer. Please trigger a "reloginBaseapp" event to the plugin, with empty event data.
def player( ):
Description:
Get the entity currently controlled by the client.
Returns:
Entity, returns the controlled entity. If it does not exist (e.g., not connected to the server), returns null.
def resetPassword( username ):
Description:
Request loginapp to reset the account password. The server will send a password reset email to the email address bound to the account (usually used for "forgot password" functionality).
Parameters:
username
: string, username.
def bindAccountEmail( emailaddress ):
Description:
Request baseapp to bind the account's email address.
Parameters:
emailaddress
: string, email address.
def newPassword( oldpassword, newpassword ):
Description:
Request to set a new password for the account.
Parameters:
oldpassword
: string, old password.
newpassword
: string, new password.
def findEntity( entityID ):
Description:
Find the instance object of an entity by its ID.
Parameters:
entityID
: int32, entity ID.
Returns:
Entity, returns the entity instance if it exists, otherwise returns null.
def getSpaceData( key ):
Description:
Get the space data for the specified key.
Space data is set by the user on the server via setSpaceData.
Parameters:
key
: string, a string key.
Returns:
string, the string data for the specified key.
Property Documentation
component
Description:
This is the component currently running in the script environment. (So far) possible values are 'cellapp', 'baseapp', 'client', 'dbmgr', 'bots', and 'editor'.
entities
Description:
entities is a dictionary object containing all entities on the current process.
Type:
entity_uuid
Description:
The uuid of the entity, this ID is bound to the entity for this login session. When using the relogin function, the server will compare with this ID to determine validity.
entity_id
Description:
The ID of the entity currently controlled by the client.
spaceID
Description:
The space ID where the entity currently controlled by the client is located (can also be understood as the corresponding scene, room, or instance).