Can you reuse system prompt answers multiple times in templater?

What I’m trying to do

I’ve been looking really hard through the templater documentation AND the forums but still have come up empty. Maybe this is something really obvious I don’t quite understand, but when using <% tp.system.prompt(“”) %> is there a way to reuse the answer to the prompt multiple times? For example, I’m making Dungeons and Dragons class notes and am trying to make a template for custom classes. I want to be able to type the number for hit dice once in the system prompt and then have it insert to where ever the number is needed.

Things I have tried

I tried the obvious of just reusing the prompt command multiple times which technically works but I have to answer the prompt multiple times. I’ve looked all around through the documentation and through the help forums. Am I missing something?

Store your answer in a variable using JavaScript execution commands.

For example:

<%* let myAnswer = await tp.system.prompt() -%>
Some random text...

My answer is <% myAnswer %>

You can apply arbitrary transformations to your answer using a JavaScript execution command
- Original: <%* tR += myAnswer %>
- Upper case: <%* tR += myAnswer.toUpperCase() %>
2 Likes

OMG thank you so much!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.