{ "name": "API Documentation", "pages": [ { "sort": 100000, "name": "Accessing the API", "type": "text", "_id": "Q4WPDTxUW6te0td1", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "

The swade-mb-helpers API can be accessed in a macro with the following line of code:

const api = game.modules.get('swade-mb-helpers').api

The name 'api' will be used for all examples but the variable name within your macro doesn't matter.

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "R9ZgY0IvWl8ovIuT": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.2", "coreVersion": "11.315", "createdTime": 1700438788646, "modifiedTime": 1700438788646, "lastModifiedBy": "R9ZgY0IvWl8ovIuT" }, "_key": "!journal.pages!Q4iS1LIiyy7acuaF.Q4WPDTxUW6te0td1" }, { "sort": 200000, "name": "api.powerEffects", "type": "text", "_id": "X0rGr7qO1SRHwy9q", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "
async function powerEffects (options = {})

powerEffects is the dispatcher behind all of the power effects in swade-mb-helpers. It will parse the options to handle power dialogs and effects for every currently handled power effect within this module.

Parameters

The only parameter is the options parameter detailed below


Options

the options object has the following fields:

One of 'item' or 'name' must be set.

Returns

There is no return value for this function.

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "R9ZgY0IvWl8ovIuT": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.2", "coreVersion": "11.315", "createdTime": 1700439000261, "modifiedTime": 1700439000261, "lastModifiedBy": "R9ZgY0IvWl8ovIuT" }, "_key": "!journal.pages!Q4iS1LIiyy7acuaF.X0rGr7qO1SRHwy9q" }, { "sort": 300000, "name": "api.requestRollFromTokens", "type": "text", "_id": "zvPWCYx402kk2hsE", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "
async function requestRollFromTokens (tokens, rollType, rollDesc, options = {})

This will request a roll from the tokens given using socketlib to request the roll from the currently logged on owner of the token.

Parameters

Options

The options object can be completely empty, but can have any or all of the following optional fields:

Returns

The return value is a list of promises which, if fulfilled, are the resulting roll objects from the token's rolls.

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "R9ZgY0IvWl8ovIuT": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1700439709611, "modifiedTime": 1703375940967, "lastModifiedBy": "sVoCvBU1knmXzoYe" }, "_key": "!journal.pages!Q4iS1LIiyy7acuaF.zvPWCYx402kk2hsE" }, { "sort": 150000, "name": "api.rulesVersion", "type": "text", "_id": "QdATvoUe4VuZrl7B", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "

(property) rulesVersion

This API property gives the premium rules version that is active, preferring Savage Pathfinder over SWADE if both are active. It returns the following key depending on the active premium module, if any.

Active Module

Key

Savage Pathfinder (SWPF)

swpf

Savage Worlds Adventure Edition (SWADE)

swade

None of the above (SWADE System only)

system

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "sVoCvBU1knmXzoYe": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1703097132367, "modifiedTime": 1703097639786, "lastModifiedBy": "sVoCvBU1knmXzoYe" }, "_key": "!journal.pages!Q4iS1LIiyy7acuaF.QdATvoUe4VuZrl7B" }, { "sort": 500000, "name": "api.fearTable(actor)", "type": "text", "_id": "oOCgnw1eVGu6Uj4U", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "
async function fearTable (actor)

The fear table API property is the fear table macro helper from whichever premium module is currently installed and active. If only the system is active and no core rules premium module is active, this will throw an exception.

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "sVoCvBU1knmXzoYe": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1703097422432, "modifiedTime": 1703097574374, "lastModifiedBy": "sVoCvBU1knmXzoYe" }, "_key": "!journal.pages!Q4iS1LIiyy7acuaF.oOCgnw1eVGu6Uj4U" }, { "sort": 300000, "name": "api.requestFearRollFromTokens", "type": "text", "title": { "show": true, "level": 1 }, "image": {}, "text": { "format": 1, "content": "
async function requestFearRollFromTokens (tokens, options = {})

This will request a fear roll from the tokens given using socketlib to request the roll from the currently logged on owner of the token. This is a special case of requestRollFromTokens.

Parameters

Options

The options object can be completely empty, but can have any or all of the following optional fields:

Returns

The return value is a list of promises which, if fulfilled, are the resulting roll objects from the token's rolls.

" }, "video": { "controls": true, "volume": 0.5 }, "src": null, "system": {}, "ownership": { "default": -1, "R9ZgY0IvWl8ovIuT": 3, "sVoCvBU1knmXzoYe": 3 }, "flags": {}, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1700439709611, "modifiedTime": 1703375850704, "lastModifiedBy": "sVoCvBU1knmXzoYe" }, "_id": "J0HiPqdHqM27gwUw", "_key": "!journal.pages!Q4iS1LIiyy7acuaF.J0HiPqdHqM27gwUw" } ], "folder": null, "ownership": { "default": 0, "R9ZgY0IvWl8ovIuT": 3 }, "flags": { "core": {} }, "_stats": { "systemId": "swade", "systemVersion": "3.2.5", "coreVersion": "11.315", "createdTime": 1700438778794, "modifiedTime": 1703375940967, "lastModifiedBy": "sVoCvBU1knmXzoYe" }, "_id": "Q4iS1LIiyy7acuaF", "sort": 100000, "_key": "!journal!Q4iS1LIiyy7acuaF" }