WeakAuras

WeakAuras

200M Downloads

Ability to programmatically interact/change/update Custom Options

Xaero252 opened this issue ยท 1 comments

commented

Is your feature request related to a problem? Please describe.
There are many situations where an option may (or may not) be relevant to an Aura based on other settings, and there are many situations where it can be useful. Currently, Custom Options, and the Custom Options view can only be modified manually by interacting with the mouse and keyboard. No functionality is built-in to allow changing the presentation of custom options or toggle their state currently.

Example A) A dynamic group that has three separate modes available: Compact, Normal, and Extended. In Custom options there are three sections, one for Compact, one for Normal, and one for Extended. Currently, all three of these sections would always be shown. By implementing this feature, we could toggle the sections based on which mode the end user has currently selected.

Example B) An aura that manages purchasing collectible items. The user could add to a shopping list by linking items into an array object in custom options. When the item is acquired by the aura, boolean could change from false to true for the collected state, or the entry could be cleared from the shopping list automatically.

Example C) An aura has an option that is dependant on another option being enabled. Disabling one option could then update the dependant option to make the item inactive (greyed out to the end user) and change the tooltip to reflect "why" this option isn't available.

Describe the solution you'd like
While it would be nice to interact directly with the forms and change them within the triggers and actions, I could see there being potential performance issues and it's likely unwise to try to update the Custom Options panel in combat. It might be best to have a wrapper function that performs these duties on behalf of the Aura author, or perhaps it would be wise to enable custom code for updating a particular Custom Option using data from the Aura's triggers instead of using only user input. At the very least, some conditional logic to be able to change the state of certain Custom Options fields would be useful.

Describe alternatives you've considered
I've considered writing a separate addon entirely, or casting the user data from Custom Options into a second table, and then changing that table on the fly. Two problems extend from the latter, there is no feedback to the user what changes have been made to the table, so when they look at custom options something may be different there than the current state of the aura. A second problem is there is no data persistence without then also using aura_env.saved to store data between sessions, and then we have to manage a second set of saved data.

Additional context
Here's an aura I've modified that I originally wanted to add the ability to purchase items "one-shot" and then remove them from the shopping list, I've commented out my attempt to remove the entry from the table in Custom Options in the On Show custom action.

https://wago.io/amBu8QMR7

Currently this is not possible to do, nor is it possible to update the Custom Options to indicate that the item has been acquired dynamically.

commented

That goes beyond the intentended use case for custom options and while we are not opposed to evolve it further, modifying the custom options from triggers not something we intend to allow.