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

Is it possible to achieve this with charactermancer ?

1563656906
Pantoufle
Pro
Sheet Author
Translator
Hello, I'm wondering if it is possible to set an attribute value of the sheet with the charactermancer (with a roll output to the chat)... I checked in the 5e charactermancer and they achieve something like this with the rolling attributes. To be more specific : I have some repeating attributes in the sheet (which, in the game, are rolled at the begining of each session) For rolling the attributes, open the charactermancer Roll for these attributes Output results in the chat Input those rolls in the attributes' values Close the charactermancer Is this something I can achieve? (I already know I could do it with sheetworker/api... but it would be a pro feature then) Thx for reading, if anything is unclear I can explain ! Hope to read your insight and guidance ! Pantoufle :)
1563720485
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Yes, it's possible, although would work more like: Open mancer Roll values Store values in mancer data Switch to mancer finish slide Now you can set actual sheet attributes and access mancer data - copy the required mancer data to the sheet Finish and close mancer You wouldn't have to do every step of that as it's own click, but you would need a click to open the mancer and one to initiate the roll. Also, keep in mind the mancer will only activate in games with a compendium active.
1563728002

Edited 1563728016
Pantoufle
Pro
Sheet Author
Translator
That would be pretty cool. Is there any example for doing that  (DD5e sheet is way too long) ? Mancer only available in compendium active game, is this intended ? :( Thx for the answer Scott !
1563735724

Edited 1563735767
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
There aren't any simple examples of mancer implementations unfortunately, if I get a free moment today I'll whip up a short proof of concept for what your talking about. As for the intention, my understanding is that yes it is intended.
1563817479
Pantoufle
Pro
Sheet Author
Translator
Wow that would be super cool Scott ! Thx Too bad a compendium is needed but well that is not really a problem since we can put one in a game even if we don't use it :p
1564773826

Edited 1564773904
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Took me a bit longer than planned to have some free time, but here's an example of how it would work. <button type='action' name='act_interact_with_chat'>Grab Chat roll</button> <span name='attr_chat_roll'>Chat Roll Will Go Here</span> <charmancer class="sheet-charmancer-roller"><!--note that charmancer elements must use double quotes and have the sheet- prefix added in the html, unlike normal sheet elements--> <div class="container"><!-- The contents of a charmancer tag should always be put inside a div--> <input type='text' name='comp_roll_result' value='Roll Result will go here'> <button type='roll' name='roll_chat' value='[[1d100]] [[1d100]] [[1d100]] [[1d100]]'>Roll to chat</button> <button type='finish' value='resolve'>Resolve Roll Result</button> </div> </charmancer> <charmancer class="sheet-charmancer-final"> <!-- You can put summary info here and updates on how the port to the sheet itself is going--> </charmancer> <script type='text/worker'> on('clicked:interact_with_chat',(event)=>{ console.log(`starting mancer`); console.log(event); startCharactermancer('roller');//load the mancer on the roller slide }); on('mancerroll:chat',(event)=>{//react to the roll console.log(`mancer roll detected`); console.log(event); setAttrs({roll_result:_.map(event.roll,(r)=>{return r.result}).join(',')},{silent:true});//Because the mancer is open, this setAttrs will only affect mancer attributes (name="comp_some_attribute") }); on('mancerfinish:resolve',(event)=>{//react to the final slide being activated console.log(`finishing mancer`); console.log(event); let data = _.reduce(event.data,(memo,slide)=>{ memo.mancerData = _.extend(memo.mancerData,slide.values); return memo; },{mancerData:{}}); console.log(data); setAttrs({chat_roll:data.mancerData.roll_result},()=>{//Because we're on the final slide, this setAttrs will affect the regular sheet finishCharactermancer();//closes the charactermancer completely }); }); </script> Unfortunately the automated transition from rolling to closing the charmancer that I had planned doesn't work as apparently opening the final slide via a sheetworker doesn't activate the normal behavior of the final slide that lets you set normal sheet attributes with setAttrs instead of charactermancer attributes.
1564778862
Pantoufle
Pro
Sheet Author
Translator
Thx a lot Scott, reading it and coming back if need be :)
1564867135
Pantoufle
Pro
Sheet Author
Translator
That works really nicely ! Question following : I have a repeating attribute called "at1", how could I manage that ? How to get at1_1=roll1, at1_2=roll2 and so on... And how to auto put the nbr of "at1" currently on the sheet in the mancer ? :p