Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

doubt about Custom Roll Parsing

1639850947
Pktome
Pro
Sheet Author
is a possible make a template for repeating section using Custom Roll Parsing for each line make a new key and value? for example, make a list of spells attack with names and button/macros for each individually and show on chat. spell area (repeating) [spell 1, button 1] [spell 2, button 2,] [spell 3, button 3...] Custom Roll Parsing "&{template:default}"+keys+"{{other commands...." on chat: <spells> <spell 1, button 1> <spell 2, button 2> <spell 3, button 3> If so, does anyone know how to do it or is there a sheet that does it?
1639863500

Edited 1639863521
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
So, you want to output a menu of all the items in a repeating section? That is certainly doable, and has been done by several sheets even before CRP. The 5e shaped, Starfinder by Roll20, and pathfinder community sheets all have this capability. To critique what's going wrong with your function, we'd need to see your actual code.
1639914261
Pktome
Pro
Sheet Author
Scott C. said: So, you want to output a menu of all the items in a repeating section? That is certainly doable, and has been done by several sheets even before CRP. The 5e shaped, Starfinder by Roll20, and pathfinder community sheets all have this capability. To critique what's going wrong with your function, we'd need to see your actual code. My idea is to create a custom template where the "content" will be generated according to the items in a repeating session. The example of the spell would be in the case of pressing a button called Grimoire and for each spell, its name and level would be put in their respective values, something like {{spellname=@{spell_name}}}{{spelllevel=@{spell_level}} }. I understand that I should have a function to "read" the lines and put that data with some kind of loop, but I want to see something ready to have a basis for how to do it. I'm going to take a look at those sheets you mentioned and see if that's what I'm looking for. something like: on('clicked:test', (info) => { // loop here... keys = [    '{{spell1=value}}',    '{{spell1=value}}',    '{{spell1=value}}',    '{{spell1=value}}',    '{{spell1=value}}',    '{{spell1=value}}'    ];    startRoll("/w gm &{template:default} {{name=@{character_name}-Spells}} "+keys+" {{end=end.}}", (results) => {    }); });
1639916727

Edited 1639916863
GiGs
Pro
Sheet Author
API Scripter
Just in case you don't know, you cant do this:  '{{spell1=value}}',    '{{spell1=value}}',    '{{spell1=value}}', In a rolltemplate, every key (the bit before the =) must be unique. So you could do  '{{spell1=value}}',    '{{spell2=value}}',    '{{spell3=value}}', or similar. As Scott says, you dont need to use startroll for this. You could, for example, have a sheet worker that updates a hidden attribute every time that the repeating section changes, and a button that sends the contents of that hidden attribute to chat. The hidden attribute will contain the printout you want.