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

Can I somehow use inline roll tooltips for custom HTML chat messages?

1497989085

Edited 1497990241
Craig B.
API Scripter
I'm working on a script implementation of the 5e mass combat rules from Unearthed Arcana. My script generates a custom HTML string with inline rolls, but then I pass it through a callback to evaluate those rolls. Can I get the inline roll output tooltip back into the HTML without re-rolling? I'm talking about the yellow box that you can over which shows the results of the roll expression.  Thanks in advance, regardless of whether it's possible. :)
1497989398
The Aaron
Pro
API Scripter
Something like this? [[ 1 [I'm talking about the yellow box that you can over which shows the results of the roll expression.  Thanks in advance, regardless of whether it's possible. :)]  ]]
1497989432
The Aaron
Pro
API Scripter
Oh, sorry, you're talking about from the API.. duh... Take a look at my Imperial Calendar script...
1497989443
Ada L.
Marketplace Creator
Sheet Author
API Scripter
Yes, but you'll have to make your own HTML and styles to render into the chat. When you do an inline roll using the sendChat function, you can give it a callback parameter to process the results of the inline rolls. From there, you'll need to use those results for the total and the roll expression to craft an HTML element styled like Roll20's built in inline roll boxes with the total and the roll expression as the element's title property. Then send that HTML element, along with any other content that might be containing it through sendChat, but this time without providing the callback parameter. 
1497989784
Jakob
Sheet Author
API Scripter
I'm working on a script implementation of the 5e mass combat rules from Unearthed Arcana. My script generates a custom HTML string with inline rolls, but then I pass it through a callback to evaluate those rolls. Can I get the inline roll output tooltip back into the HTML without re-rolling? If the output is initially already in the desired form, and you don't need to process it further depending on the results of the inline rolls, you might consider not  using a callback, but sending it to chat normally and then listening to the result of your script-sent chat message (chat messages sent by scripts do  generate chat:message events in the API). If you do need to change the output depending on the content of the rolls, you will have to do what Stephen suggested. If you want to take a look at my (terrible) code, I have an example of a function trying to faithfully recreate the inline rool including tooltip as part of GroupCheck (I leave out the yellow background, but that's easy enough to add).
1497989797
The Aaron
Pro
API Scripter
Specifically the esRE() function on line 32, the HE() function on line 37, and the tipExtra variable created in the buttonMaker() function on line 388.
1497990136

Edited 1497990221
Craig B.
API Scripter
Aha! I was using `original-tooltip` based on the HTML that roll20 puts in chat. In retrospect I should have guessed that it was js generated and had come from the `tooltip` attribute. Thanks all! Any chance a mod can mark this as "answered" or "solved" in some way? Or is there a way I can do that?
1497990433

Edited 1497990462
The Aaron
Pro
API Scripter
I could close it?   The attribute you want is title not tool-tip , and you need to have the classes 'showtip' and 'tipsy'.
The Aaron said: The attribute you want is title not tool-tip , and you need to have the classes 'showtip' and 'tipsy'. Yeah, that. I got it working, just misspoke above. original-title is also the attribute that it becomes. You'd think being a professional developer who writes JS apps and works with HTML all day every day that I would remember what these things are called...lol Thanks for the help! 
1498055300
The Aaron
Pro
API Scripter
Cheers!  No problem. Happy Rolling!