RollCapture — Generic Roll Result Extraction RollCapture listens to your roll template messages, extracts the actual numeric results, and makes them available for other scripts or character abilities to use. Works with any character sheet — you define the rules. The Problem Roll20's API gives you msg.inlinerolls with raw dice data, but figuring out which roll is the "result" depends on the character sheet's template structure. Every sheet is different. RollCapture lets you define simple extraction rules per template so the right value is captured automatically. Tip: Use !rollcapture dissect before writing rules — it shows you exactly what fields and values your sheet produces for any roll. How It Works Create a handout tagged [RC] with your capture rules Rolls happen normally — RollCapture silently extracts the values Captured values fire character abilities ( rc_stealth , rc_any , etc.) with the result substituted in Rule Format (with examples) D&D 5E Skills (single value): template: npc, simple name_field: rname char_field: name, charname when: {{advantage=1}} result: max(r1, r2) when: {{disadvantage=1}} result: min(r1, r2) default: result: r1 D&D 5E Attacks (multiple captures from one roll): template: atkdmg, npcfullatk name_field: rname char_field: charname when: {{advantage=1}} attack: max(r1, r2) damage: sum(dmg1, dmg2, globaldamage) crit_dmg: sum(crit1, crit2, globaldamagecrit) when: {{disadvantage=1}} attack: min(r1, r2) damage: sum(dmg1, dmg2, globaldamage) crit_dmg: sum(crit1, crit2, globaldamagecrit) when: {{always=1}} attack: choose(r1, r2) damage: sum(dmg1, dmg2, globaldamage) crit_dmg: sum(crit1, crit2, globaldamagecrit) default: attack: r1 damage: sum(dmg1, dmg2, globaldamage) crit_dmg: sum(crit1, crit2, globaldamagecrit) Use ${attack} and ${damage} in abilities to reference each capture separately. Rules support: Conditional extraction — different formulas based on template flags Formulas — max() , min() , sum() , choose() (prompts GM with buttons) Multiple captures — extract attack AND damage from the same roll Comments — lines starting with # are ignored Character Abilities After capturing, RollCapture checks the rolling character for abilities: rc_any — fires on every capture rc_stealth (or any rc_<rollname> ) — fires for that specific roll rc_default — fires when no specific match exists Use ${result} and ${rollname} in the ability action for substitution. Example ability ( rc_stealth ): !w gm @{character_name} rolled stealth: ${result} Commands !rollcapture — Show help !rollcapture rules — List loaded rules (clickable links) !rollcapture rule <name> — Create/open a rule handout (with syntax guide) !rollcapture dissect — Dissect the next roll (shows all fields and values) !rollcapture reload — Reload after editing rules For Script Authors RollCapture exposes an API for other scripts to consume captures: RollCapture . onCapture ( 'MyScript' , function ( event ) { // event = { charName, charId, rollName, captures, playerId, msg } }); Emits !rollcapture-ready on init for load-order-safe registration. Install Available in the Roll20 Mod Library. No dependencies. See Also Customizable Roll Listener by Scott C. — a similar concept for reacting to roll templates. RollCapture's character ability approach was inspired by CRL's design. The key difference: RollCapture extracts the actual numeric roll results and makes them available via ${result} substitution and a programmatic API. GitHub Source | Wiki Page