[Multiple Features] Comments, Templates, Abort Conditionals, Variable Conditionals, Actions Cut + Copy + Paste
Is this a feature relevant to companion itself, and not a module?
- [X] I believe this to be a feature for companion, not a module
Is there an existing issue for this?
- [X] I have searched the existing issues
Describe the feature
I've been building myself a few somewhat more complex features using Companion recently. Companion is very powerful and allows me to do a lot of things. However, often Companion itself gets in my way of implementing solutions in an effective and straight forward way. It does not give me powerful enough tools to work efficiently and effectively, both in terms of helping me implement build solutions as well as how much boilerplate and workarounds need to be built to achieve a certain solution. Companion is probably already touring-complete, it just feels like you need to do everything on hands and knees. Here are some suggestions on improving quality of life especially for more complex implementations, that shouldn't explode complexity of Companion itself.
Comments
Companion actions can become quite large an unwieldy. It would be useful if we could add small lines of comments or notes to actions or as separate dummy actions to document our thought process and make returning to complicated action chains later again more easy.
Action Cut + Copy + Paste or Duplicate + Move
It is possible to move and duplicate whole buttons, but often it would be useful to be able to copy and paste or move a single or a set of actions from one button to another or from the Press queue to the Release queue within the same button. (Note: Parts of this feature request have been suggested before).
Abort Conditionals
Companion supports conditionally pressing a button. As a result, creating buttons that do one thing but another thing under a specific condition always requires creating additional buttons, either visible or hidden. Often the same effect could be achieved much simpler without additional buttons by having a conditional abort action, that stops the execution of other actions in the queue when the condition is met.
Variable Conditionals
Allow setting of a custom variable value only if a given condition was met. Easily allows simple constraints e.g. prevent a variable from dropping below 0 or above 100 or setting a variable to "ON" if another variable is 1 or to "OFF" if another variable is 0. These things are currently already possible, but require cumbersome workarounds, helper buttons or triggers.
Templates
The biggest for last. Companion started adding custom variables as well as a whole set of different actions meant to allow working with those variables, like expressions or string concatenations. But at the same time, certain things are still incredibly cumbersome to do. E.g. displaying different text based on a variable value should only be a simple ternary, but in practice requires complex multi-button setups and multiple support variables to work around the limitations of Companion.
I propose that Companion instead embrace some form of standardized templating, most conveniently probably JS template literals. That would give more advanced users a lot more power in being able to express variables, values and button text in Companion while also keeping complexity in check, especially in regards to limiting the executed code to expressions and JS built-ins.
Obviously other templating engines like Jinja are a reasonable option, too.
A good templating engine would give significantly more power to advanced users while reducing the complexity of Companions actions ecosystem.
Usecases
(see above)