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

[API] Setting Repeatable values from API?

1429734982

Edited 1429735598
Kryx
Pro
Sheet Author
API Scripter
Another fun question: Based on the wiki: <a href="https://wiki.roll20.net/Character_Sheets#Repeating" rel="nofollow">https://wiki.roll20.net/Character_Sheets#Repeating</a>... Using the example code there: &lt;h3&gt;Skills&lt;/h3&gt; &lt;fieldset class="repeating_skills"&gt; &lt;select name="attr_dtype" class="dtype"&gt; &lt;option value="d4"&gt;d4&lt;/option&gt; &lt;option value="d6"&gt;d6&lt;/option&gt; &lt;option value="d8"&gt;d8&lt;/option&gt; &lt;option value="d10"&gt;d10&lt;/option&gt; &lt;option value="d12"&gt;d12&lt;/option&gt; &lt;/select&gt; &lt;input type="text" name="attr_skillname" /&gt; &lt;/fieldset&gt; Can I set "repeating_skills_0_skillname" via the API? I assume so since I saw some spell importers for 5e a while ago. But I also see " Do not attempt to manage these attributes manually " Any insight here? Preemptive: Thanks Aaron! :D EDIT: Found a thread about it: <a href="https://app.roll20.net/forum/post/1031128/api-character-sheet-repeating-fields" rel="nofollow">https://app.roll20.net/forum/post/1031128/api-character-sheet-repeating-fields</a> Kevin if you're around I'd love to understand what you did.
1429736403
The Aaron
Pro
API Scripter
Ha! I'll have to try this out tonight...
1429739351

Edited 1429739359
Kryx
Pro
Sheet Author
API Scripter
It does indeed seem to work as normal, mostly.
Mark, it does indeed work, if you still have questions let me know. The work I did was in the form of some loops while parsing data, so not sure what you are attempting to do, but it is possible.
1429742238

Edited 1429742367
Kryx
Pro
Sheet Author
API Scripter
Any insight on how hidden inputs work? For instance inside the repeat fieldset &lt;fieldset class="repeating_actions"&gt; I have: &lt;input type="hidden" name="attr_npc_action_var_attack" value="{{npc_action_show_attack=1}} {{npc_action_attack=[[d20cs&gt;@{npc_action_crit_range} + @{npc_action_tohit} + (@{global_melee_attack_bonus})]]}}"&gt; I have a checkbox in the fieldset that is set to the value of that hidden input when it is checked: &lt;input type="checkbox" name="attr_npc_action_toggle_attack" class="sheet-npc-action-tab sheet-npc-action-toggle-attack" value="@{npc_action_var_attack}"&gt;&lt;span class="sheet-npc-action-tab sheet-npc-action-toggle-attack"&gt;Attack&lt;/span&gt; The referenced "tohit" is also an input inside the fieldset &lt;input class="sheet-center" type="number" name="attr_npc_action_tohit" value="0"&gt; attr_npc_action_toggle_attack seems to become "repeating_actions_npc_action_to_hit" Without repeating to set that "attr_npc_action_toggle_attack"checkbox as "checked" I needed to set its value in the API to be equal to "@{npc_action_0_var_attack}". It doesn't seem to work if I now set it to "@{repeating_actions_0_npc_action_var_attack}". Any ideas?
1429742418
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
<a href="https://app.roll20.net/forum/post/1164428/thinking" rel="nofollow">https://app.roll20.net/forum/post/1164428/thinking</a>... I did a lot with recordsheets in that code. Its not very efficently written but I did a lot with just about every part of a recordsheet.
1429742517
Stephen S.
Pro
Marketplace Creator
Sheet Author
API Scripter
Keep in mind we didn't have obj.remove() then... I figure with obj.remove() you could really smack a record sheet around.
1429743526
Kryx
Pro
Sheet Author
API Scripter
Mark said: Any insight on how hidden inputs work? For instance inside the repeat fieldset &lt;fieldset class="repeating_actions"&gt; I have: &lt;input type="hidden" name="attr_npc_action_var_attack" value="{{npc_action_show_attack=1}} {{npc_action_attack=[[d20cs&gt;@{npc_action_crit_range} + @{npc_action_tohit} + (@{global_melee_attack_bonus})]]}}"&gt; I have a checkbox in the fieldset that is set to the value of that hidden input when it is checked: &lt;input type="checkbox" name="attr_npc_action_toggle_attack" class="sheet-npc-action-tab sheet-npc-action-toggle-attack" value="@{npc_action_var_attack}"&gt;&lt;span class="sheet-npc-action-tab sheet-npc-action-toggle-attack"&gt;Attack&lt;/span&gt; The referenced "tohit" is also an input inside the fieldset &lt;input class="sheet-center" type="number" name="attr_npc_action_tohit" value="0"&gt; attr_npc_action_toggle_attack seems to become "repeating_actions_npc_action_to_hit" Without repeating to set that "attr_npc_action_toggle_attack"checkbox as "checked" I needed to set its value in the API to be equal to "@{npc_action_0_var_attack}". It doesn't seem to work if I now set it to "@{repeating_actions_0_npc_action_var_attack}". Any ideas? Solved this by setting it to "@{npc_action_var_attack}" with none of the repeating stuff
1429749811

Edited 1429750059
Kryx
Pro
Sheet Author
API Scripter
So my goal with this repeating section was to be able to do what the pathfinder sheet did and put in manual buttons that allow you to roll repeatable sections. Link to some of the code I quoted <a href="https://app.roll20.net/forum/post/1498595/#post-18" rel="nofollow">https://app.roll20.net/forum/post/1498595/#post-18</a>... It seems repeating sections cannot reference anything explicitly defined. For instance my import script sets "type" to "melee" for several actions, but for those it doesn't I get this error: No attribute was found for @{Ancient Black Dragon|repeating_actions_3_type} The same issue exists if I try to access an input that is hidden. For example: &lt;input type="hidden" name="attr_macro_options" value="@{toggle_emote} @{toggle_attack} @{toggle_attack_adv} @{toggle_crit} @{toggle_details} @{toggle_damage} @{toggle_alt_damage} @{toggle_second_damage} @{toggle_save} @{toggle_save_damage} @{toggle_effects} @{toggle_multiattack} @{toggle_recharge}"&gt; It fails to access that variable at all. Returning: No attribute was found for @{Ancient Black Dragon|repeating_actions_3_macro_options} I need to find a way forward. I doubt every variable in the PF script is always set.. blaaaaaaaaaaaah I really wish the devs would work on Official support for repeating sections in character sheets Let me know if anyone has any suggestions.