|Last updated||1 month ago|
|Created||4 months ago|
|Project source||Project URL|
|Report bugs||Bug tracker URL|
This is a library module, it does nothing on its own, but provides several functions for use in macros or by other modules.
Mainly, these functions are intended to help with making macros for use with MidiQoL, DAE, and similar automation modules.
All functions are accessible at
badIdeas.functionName will be created if available (i.e. if it doesn't already exist in the globalThis object) as a convenience accessor. I don't think there should be clashes, but if there are then whatever is clashing with this will win.
This is set up as a hook on "init", so won't be available before then, and probably not in other "init" hooks.
isMainGM() : Returns true if the current user is the first active GM. Equivalent to
game.users.find((u) => u.isGM && u.active)
. removed as no longer necessary in 0.8
async entityFromUuid(uuid) : Returns an Entity of the appropriate type (Scene, Token, Actor, etc.) for any UUID in the world (i.e. not in a compendium), including UUIDs for embedded entities. If this fails for any object, please add an issue to this repo. Where a base entity type is extended (e.g. Actor5e from Actor) this generally will return an object of the base entity type, rather than the extended type.
All the functions here can be called by anyone, and will then be executed by the GM. This allows users to update or delete pretty much anything if they have enough macro knowledge. Don't install this if you don't trust your users.
documentGetFlag(document, scope, flag) , documentSetFlag(document, scope, flag, value) , documentUnsetFlag(document, scope, flag) : gets/sets/unsets the flag specified by
scope, flag for the document specified by
document (which needs to be the actual document object).
documentUpdate(document, newData, options) : calls
document.update(newData, options) on the GM side.
documentDelete(document, options) : calls
document.delete(options) on the GM side
documentCreateEmbeddedDocuments(document, embedType, embedData, options) and
documentDeleteEmbeddedDocuments(document, embedType, embedData, options) call the equivalent GM side functions (note that embedData must be an array in 0.8)
applyCUBCondition(condition, document) , removeCUBCondition(condition, document) uses Combat Utility Belt to apply/remove the specified condition.
condition is the name of the condition (as a string),
document is the document (i.e. Token or Actor) to apply/remove the condition to/from. This will return
false if CUB is not active in the world (and handling that is your problem!)
All functions are async, and return the value of their equivalent GM side function if successful.
pre-0.8 versions of these functions (using "entity" in place of "document") are provided, but just call the new versions with appropriate argument transformations.
To install this package, open your Foundry Setup screen and navigate to your Module tab and click the Install Module button.
From there, you can either search for the package unique name: bad-ideas-toolkit or copy its manifest URL:
And paste it to the input box at the bottom of your window.
You can install this package directly to your Forge account.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Advertisement cookies are used to deliver visitors with customized advertisements based on the pages they visited before and analyze the effectiveness of the ad campaign.