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 .
×
Advertisement Create a free account

Need help with using roll templates (or maybe powercards) to format my roll outputs. Can tooltips be used?

1515542165

Edited 1515585989
Chris D.
Pro
Sheet Author
API Scripter
I started upgrading my character sheet to use roll templates, and have run into some major snags trying get what I expected. I know that if you submit an inline roll such as [[2d8!]] it will automatically give you a colored box with the result, and that if you hover over the box it will tell you what each of the dice rolled.  I understand this works ether with or without roll templates.  I also know that if I send something to a non-roll template such as [[4[text]]] it will display the 4 and the text when I hover over it. This lead me to make some unfounded assumptions that I could just put anything in there I wanted and it would display.  I have tried adding various [[]] things to the roll template, and that did not work for reasons that were obvious to me as soon as I considered it.  I also tried sending [[n[text]]] properties to a roll template invocation, and that did not work at all.  So the question is, is there some way for me to set a programmable tooltip hover-over message using roll templates? Is powercards what I should be using? Should I forget about all the things that give me 85% of what I want and just have my code generate my own html? So I would appreicate any suggestions for what I can do to get tool tips working, or to best display what I want. Thanks.
1515550354
The Aaron
Forum Champion
API Scripter
There's a whole blend of things going on in this post, to the point where I'm not even sure what you're really asking. =D If you're outputting from an API, I would avoid depending on Roll Templates except for the case where you are explicitly duplicating the output of a roll button on the character sheet.   You have much greater control writing out your own HTML. If you want to get tooltips working with the API, have a look at my  Imperial Calendar script:   I did quite a bit of work with getting them to show up and  putting well formatted HTML in them. (btw, avoid <div>s and use <span>s with "display: block" instead).  The buttonMaker function on line 387 is probably the simplest example to follow.  The key is adding the classes "showtip" and "tipsy" to the element you want to hover, and then putting whatever you want to show in the title property of the element.  You need to doubly encode any HTML entities if you do that ( See my HE() in there doing that).
1515559979
Chris D.
Pro
Sheet Author
API Scripter
Thank you very much.  Yes, when I get frustrated I tend to get wordy and include all sorts of unnecessary detail.  I probably could have skipped 2/3 of my origional post and just said "I think I am probably using the wrong tool for the job again, what tools should I be using?" And it sounds like the answer is that for what I want to do, my API should be sending out formed html.  I am looking at the imperial calandar now.  Thanks!