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

Condition description on tool tip

Hi all,  I'm trying to find a way to automatize this. select a character, click on the macro to choose a condition's status marker to apply to that character, and automatically create the tooltip to have the condition description on mouse hovering. If several status markers, then the tool tip should show all descs for all status markers applied, and if no status markers, then erase and hide the tool tip on the selected character maybe it would be possible to "listen" to a character and set a tool tip if a/several status marker(s) is/are detected. Does that already exist ? if so i couldn't find where.... And for info, i play dd5, using roll20 OGL sheet, and yes, I have access to APIs. Thanks for your help.
1655559042

Edited 1655559111
Andreas J.
Forum Champion
Sheet Author
Translator
(btw, API requires Pro subscription from the Game's GM, noticed you only have free account) You could construct this functionality using commands from existing API scripts, so it's not necessary to code a separate API script from scratch. Below is a simple way to do it. I'm sure Meta-Toolbox could be leveraged to make a more robust command, but Condition Info in tooltip with TokenMod A roll query asking for the name of condition to be added, and then the executing part of the query call Tokenmod to update the selected character's tooltip. Turn on and update tooltip for selected character: !token-mod --set tooltip|"Hey, you can see this on hover!" --on show_tooltip Dropdown menu to choose between tooltip descriptions, for selected character. (Includes option to clear&hide the tooltip) !token-mod --set tooltip|?{Condition|Prone,"disadvantage on melee attacks" --on show_tooltip|Grappled,"A grappled creatures speed becomes 0" --on show_tooltip|Incapacitated,"An incapacitated creature can’t take Actions or Reactions." --on show_tooltip|clear tooltip, --off show_tooltip} The above macro could be a good start, but depending on how you want it to work, you might need to look more into how TokenMod. (I had some trouble making it show the tooltip, and on one try the an incomplete description was saved; but seems it was bug on my pc, as tooltips worked normally when I exited and re-entered game.) Normally tooltips have 150 character limit, but according to Keith APIs can override that, so you could probably make pretty long descriptions, but there is no formatting so longer stuff might be hard to read. Apostrophes and other special characters might cause troubles.
Thank you for your answer,  That will definitely help me for my purpose, I'll add the --set statusmarker# to include my needs.  Not sure it will work if there is more than one condition, because not sure the tooltip can be appended with the api or if it would replace the previous one.  >I'll give it a few tries and let you know where i stand at ! Thank you anywat for your answer and help on that. 
1655568488
David M.
Pro
API Scripter
Here's a scriptcard that: Queries if you want to add or remove a condition Queries for which condition to add or remove. Performs a lookup for the statusmarker tied to that condition Adds or removes the statusmarker to the token corresponding to the condition specified Updates the tooltip with the condition(s). Any statusmarkers that aren't found during the lookup are just ignored by the tooltip Note 1: these conditions could be names (e.g. prone, stunned) or full descriptions (e.g. "disadvantage on attacks", etc.). I only added a few conditions below. You would need to update the ?{Which Condition...} query as well as the two lookup functions with the conditions you want to use. These lines are bolded in the code sample below. Note 2: If you select "Remove all conditions", you will still be prompted for "Which Condition?". You'll just have to ignore that and click through. !script {{ --#hidecard|1 --:USER QUERY FOR CONDITIONS TO ADD/REMOVE| Note: Remove all will still query for a condition, just ignore & click thru --&addRemove|?{Adding or removing condition?|Add Condition,Add|Remove Condition,Remove|Remove All Conditions,RemoveAll} --&condition|?{Which Condition?|Concentrating|Charmed|Prone|Restrained} --:LOOKUP STATUSMARKER FOR GIVEN CONDITION DESCRIPTION| -->LookupMarkerFromCondition|[&condition] --:GET CURRENT STATUS MARKERS ON TOKEN| insert into array called markerArr --~|array;statusmarkers;markersArr;@{selected|token_id} --:ADD OR REMOVE THE MARKER FROM ARRAY| --?[&addRemove] -eq "Add"|[ --~|array;add;markersArr;[&marker] --]| --?[&addRemove] -eq "Remove"|[ --~|array;remove;markersArr;[&marker] --]| --?[&addRemove] -eq "RemoveAll"|[ -->RemoveAllConditions| --]| --:LOOP THRU MODIFIED ARRAY OF MARKERS & BUILD TOOLTIP LIST OF CONDITIONS| --~thisMarker|array;getfirst;markersArr --?[&thisMarker] -eq ArrayError|>RemoveAllConditions --:Loop| -->LookupAndAppendTooltip|[&thisMarker] -->AppendStatusMarkerString|[&thisMarker] --~thisMarker|array;getnext;markersArr --?[&thisMarker] -ne ArrayError|Loop --:UPDATE THE TOKEN WITH THE TOOLTIP AND MODIFY THE STATUSMARKERS API TOKEN PROPERTY --!t:@{selected|token_id}|tooltip:[&tooltip]|show_tooltip:true|statusmarkers:[&statusmarkers] --:End| --X| End Macro --:FUNCTIONS| --:LookupAndAppendTooltip| accepts statusmarker as parameter, appends corresponding condition to tooltip string --?[%1%] -eq "cobweb"|&desc;Restrained --?[%1%] -eq "back-pain"|&desc;Prone --?[%1%] -eq "chained-heart"|&desc;Charmed --?[%1%] -eq "overdrive"|&desc;Concentrating --?"X[&tooltip]" -eq "X"|[ --&tooltip|+[&desc] --]|[ --&tooltip|+, [&desc] --]| --<| --:LookupMarkerFromCondition| accepts condition text as parameter, finds corresponding statusmarker --?[%1%] -eq "Restrained"|▮cobweb --?[%1%] -eq "Prone"|▮back-pain --?[%1%] -eq "Charmed"|▮chained-heart --?[%1%] -eq "Concentrating"|▮overdrive --<| --:AppendStatusMarkerString| accepts statusmarker string, appends as comma-delimited list --?"X[&statusmarkers]" -eq "X"|[ --&statusmarkers|+[%1%] --]|[ --&statusmarkers|+,[%1%] --]| --<| --:RemoveAllConditions| --!t:@{selected|token_id}|tooltip:|show_tooltip:false|statusmarkers: --X| --<| }}
1655662461

Edited 1655672559
Thanks a lot. Tht's exactly what i was looking for. Will work on that after my tonight's game. EDIT : Just as curiosity, can special characters such as : or bullets be in the description or do i Need the substitute ?