Dynamic Triggers

Have a dynamic trigger that can trigger on multiple options that you don't have to manually create.

for example, the trigger: /[DYNAMIC]k would do something like this:

/1k = $1,000
/7k = $7,000
/150k = $150,000

where it would take anything in the [DYNAMIC] section and add it into the snippet wherever you select, as long as the rest of the trigger works.

I know this isn't exactly what you were looking for, but perhaps you could rig up a workaround for the most common ones using imports and {snippet:shortcut}.

  1. Make a main snippet
  2. Make a snippet with the sole purpose of being a trigger (that snippet's info is passed through to the main snippet)
  3. Profit :slight_smile:

Here's an example:
Set up your main snippet as "mainbanana":

There are {if: {snippet:shortcut} = "$1banana"}1000{elseif: {snippet:shortcut} ="$2banana"}2000{elseif: {snippet:shortcut} ="$3banana"}3000{else}{formtext: name=How Many Bananas?}{endif} bananas!

Then set up the 3 (in this example) trigger snippets. $1banana, $2banana, $3banana

{import: mainbanana}

When you trigger it with $1banana your output will be "There are 1000 bananas!" but when you trigger it with $2banana your output will be "There are 2000 bananas!". I suppose you could set this up for every possibility, but you could also just do it for the most common ones and leave the else option for a fallback.

1 Like

Building on top of Kevin's excellent suggestion, here's a snippet that uses regex to handle your specific case of outputting money:

The amount is {value=extractregex({snippet: shortcut}, "/(\d+)k")}{=value * 1000; format=$,.2f}

And then all other snippets would be the same as each other: importing this main snippet. For example: "/1k" snippet will be like this:

{import: mainamount}