For AI agents: the complete documentation index is available at /llms.txt, the full documentation bundle is available at /llms-full.txt, and this page is available as Markdown at /server/classes/MolangVariableMap.md.

Class: MolangVariableMap

Beta

包含一组额外的变量值,用于进一步定义渲染和动画的工作方式。

Contains a set of additional variable values for further defining how rendering and animations function.

Constructors

Constructor

new MolangVariableMap(): MolangVariableMap

Beta

Returns

MolangVariableMap

Methods

setColorRGB()

setColorRGB(variableName, color): void

Beta

Molang 添加以下变量:

  • <variable_name>.r - 红色颜色值 [0-1]
  • <variable_name>.g - 绿色颜色值 [0-1]
  • <variable_name>.b - 蓝色颜色值 [0-1]

Parameters

variableName

string

color

RGB

Returns

void

Remarks

Adds the following variables to Molang:

  • <variable_name>.r - Red color value [0-1]
  • <variable_name>.g - Green color value [0-1]
  • <variable_name>.b - Blue color value [0-1]

Throws

This function can throw errors.


setColorRGBA()

setColorRGBA(variableName, color): void

Beta

Molang 添加以下变量:

  • <variable_name>.r - 红色颜色值 [0-1]
  • <variable_name>.g - 绿色颜色值 [0-1]
  • <variable_name>.b - 蓝色颜色值 [0-1]
  • <variable_name>.a - Alpha(透明度)颜色值 [0-1]

Parameters

variableName

string

color

RGBA

Returns

void

Remarks

Adds the following variables to Molang:

  • <variable_name>.r - Red color value [0-1]
  • <variable_name>.g - Green color value [0-1]
  • <variable_name>.b - Blue color value [0-1]
  • <variable_name>.a - Alpha (transparency) color value [0-1]

Throws

This function can throw errors.


setFloat()

setFloat(variableName, number): void

Beta

Molang 变量映射中设置一个数值(小数)。

Parameters

variableName

string

要设置的浮点数的名称。 Name of the float-based number to set.

number

number

要为基于 Molang 的变量设置的值。 Value for the Molang-based variable to set.

Returns

void

Remarks

Sets a numeric (decimal) value within the Molang variable map.

Throws

This function can throw errors.


setSpeedAndDirection()

setSpeedAndDirection(variableName, speed, direction): void

Beta

Molang 添加以下变量:

  • <variable_name>.speed - 提供的速度数值
  • <variable_name>.direction_x - 提供的 Vector3 中的 X 值
  • <variable_name>.direction_y - 提供的 Vector3 中的 Y 值
  • <variable_name>.direction_z - 提供的 Vector3 中的 Z 值

Parameters

variableName

string

speed

number

direction

Vector3

Returns

void

Remarks

Adds the following variables to Molang:

  • <variable_name>.speed - Speed number provided
  • <variable_name>.direction_x - X value from the Vector3 provided
  • <variable_name>.direction_y - Y value from the Vector3 provided
  • <variable_name>.direction_z - Z value from the Vector3 provided

Throws

This function can throw errors.


setVector3()

setVector3(variableName, vector): void

Beta

Molang 添加以下变量:

  • <variable_name>.x - 提供的 Vector3 中的 X 值
  • <variable_name>.y - 提供的 Vector3 中的 Y 值
  • <variable_name>.z - 提供的 Vector3 中的 Z 值

Parameters

variableName

string

vector

Vector3

Returns

void

Remarks

Adds the following variables to Molang:

  • <variable_name>.x - X value from the Vector3 provided
  • <variable_name>.y - Y value from the Vector3 provided
  • <variable_name>.z - Z value from the Vector3 provided

Throws

This function can throw errors.