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 .
×

detecting successes from roll template results

(Warning, noob here) I am trying to write a script that would result in a sendChat when a roll for a certain character is successful. The issue is that I would like to do this when the roll is made from a character sheet (whose html I can not change). A typical comment's content is like this: Content: 0 {{name=Guy -- Roc Ingersol }} {{title=first aid}} {{roll=$[[0]]}} {{roll_target=$[[1]]}}{{roll_difficulty=$[[2]]}} {{roll_half=$[[3]]}} {{roll_fifth=$[[4]]}} {{roll_fifth_1=$[[5]]}} {{roll_bonus=[Bonus / Penalty](~-M8hhavp0zBnI1kMrCHr|bonus)}}" I can detect when it was rolled by the character Guy, and give a result using chat:message ,  but I'm not sure how to check for success. The value for a roll button in the html is, for example, this @{roll_whisper} &{template:callofcthulhu} {{name=@{character_name}}} {{title=climb}} {{roll=[[1d100cs<1cf>@{roll_cf}]]}} {{roll_target=[[floor(@{climb}/@{dice_toggle}}} {{roll_half=[[floor(@{climb}/2)]]}} {{roll_fifth=[[floor(@{climb}/5)]]}} {{roll_fifth_1=[[floor(@{climb}/5)+1]]}} {{roll_bonus=[@{translation_bonuspenalty}](~@{character_id}|bonus)}} And in the roll template, it checks for success like so:  {{#rollTotal() roll roll_target }} <div class="sheet-callofcthulhu-success" data-i18n="success">success</div>{{/rollTotal() roll roll_target }} Any help would be appreciated!
1591761426

Edited 1591761622
GiGs
Pro
Sheet Author
API Scripter
The API cant read the rolltemplate. You'll have to have your script read the chat, parse out the values you need, and analyse the roll result, completely independently of the rolltemplate. If the rolltemplate is always in exactly the same format, you can use the msg.inlinerolls property: roll, roll_target, roll_half, etc., will be rolls 0, 1, 2, and so on respectively, so it wont be too hard. msg.inlinerolls[0].results.total will be the result of the first roll. If the template varies, you might have a trickier problem.
Ah, that is a great help! Thank you.
1591762594
GiGs
Pro
Sheet Author
API Scripter
You're welcome :)