Module

This page goes over about the Module object.

unregister(): Undefined

Unregisters the module.

toggle(): Undefined

Toggles the module.

getName(): String

Returns the module name.

getTag(): String

Returns the module tag for arraylists.

getCategory(): String

Returns the module category.

getDescription(): String

Returns the module description.

isEnabled(): Boolean

Returns if the module is enabled or not.

handle(type, handler): Undefined

Argument
Type
Description

type

String

The type of event to handle.

handler

function (args: String[]): Undefined

Callback function.

Adds a event handler. Handler lists can be found in events documentation.

setEnabled(enabled): Undefined

Argument
Type
Description

enabled

Boolean

Whether the module will be enabled.

Enables/disables the module.

registerSetting(type, name, defaultValue, params...): Undefined

Argument
Type
Description

type

String

The type of setting to register. Currently supported types are: string, number, boundsnumber, boolean, color, or mode.

name

String

Setting name.

defaultValue

See the description

Default value for the setting. Type is: string for string settings and mode setting, Number for number, boundsnumber settings, Boolean for boolean settings, and 3 or 4 element Number array for color settings, with the elements corresponding to RGBA.

params...

Additional parameters. See below.

Registers a setting to the module.

For the number setting, the first and second additional parameters are minimum and maximum bounds for the setting, while the third one is for the decimal places (not required, defaults to 2 decimal places.) Default value type is JS Number.

For the boundsnumber setting, the first additional parameters argument is the second default value. 2nd and 3rd arguments are minimum and maximum bounds for both of the numbers. The last parameter is step size for the setting. Default value type is JS Number.

For the boolean and string settings, the additional parameters do not exist. Default values for them correspond to their JavaScript types.

For the color setting, there are no additional parameters. Default value type is a 3 or 4 element array, with the elements corrseponding to the RGB(A) channel values. 4th element for the Alpha channel in the array is not required.

For the mode setting, the additional parameters are all the sub-modes.

setSetting(name, value): Undefined

Argument
Type
Description

name

String

Setting name.

value

See the description

The new value for the setting. Type is: string for string settings and mode setting, Number for number, boundsnumber settings, Boolean for boolean settings, and 3 or 4 element Number array for color settings, with the elements corresponding to RGBA.

Sets a setting of the module. Read the doucmentation for the method above to see more information.

getSetting(name): Boolean || Number[] || Number || String

Argument
Type
Description

name

String

Setting name.

Returns the setting value.

For the boolean setting, it returns a Boolean object.

For the string setting, it returns a String object.

For the boundsnumber setting, it returns a 2 element array, with the 1st element corresponding to the 1st value and the 2nd element corresponding to the 2nd value.

For the number setting, it returns a Number object.

For the color setting, it returns a 4-element array that you can use in other scripting APIs (Like the Render API).

For the mode setting, it returns the mode name.

If the setting is not found, this method returns null.

setSettingVisibility(name, visible): Undefined

Argument
Type
Description

name

String

Setting name.

visible

Boolean

Whether to draw the setting or not.

Sets the setting visibility.

You have to call this method whenever you want to update setting visibility, it does not update automatically.

Last updated