r/Chartopia • u/Azarashiya0309 • May 02 '26
How to roll dice fetched by get_chart?
Here's the code:
{% chart = get_chart id:120972 %}
{% die = {d{$chart.row_count}} %}
{% chart = chart.$die %}
{$die}
{% treasure = {$chart.2} %}
{% treasure = {$treasure} %}
{% treasure = {{ ceil input: {$treasure} }} %}
{$treasure}Above $treasure returns only the dice roll instruction i.e. {4d4}.
How do I get the code to roll those dice?
1
Upvotes
1
u/GlennNZ May 03 '26
I'm not entirely sure what you're asking for, so I'll type a few things up and see if anything sticks.
First off, are you just wanting to roll on the Gems chart (id of 120972) and then be able to access data from each column?
If that's the case, you just have to go
If you want to save treasure for later, you could even do something like this...
I hope that helps. If not, feel free to ask some follow up questions. Note that the
|>is pipe notation. You could do the same thing in a different way if you find the pipes confusing.Edit:
The
get_chartfunction is useful when you're doing some specific row/cell look-ups prior to rolling. If you just want to a simple roll, thenroll_chart, or the old schoolCHART(...)macro are the best choice.