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

[Scirpt,Snippet] Hide Tooltips on face down cards.

1649551290

Edited 1651200850
The Aaron
Roll20 Production Team
API Scripter
There was a request for this script a while back and it completely slipped my mind to write it.   DamonReborn  reminded me, so here I went ahead and knocked it out.  It's completely automatic, just install it and face down cards will have their tooltips hidden while face up ones will have them revealed. Code: on('ready',()=>{ const checkInstall = () => { let cards = findObjs({type:'graphic', subtype:'card'}); const burndown = ()=>{ let c = cards.shift(); if(c) { if( 0 === c.get('currentSide')){ c.set({show_tooltip: true}); } else { c.set({show_tooltip: true}); c.set({show_tooltip: false}); } setTimeout(burndown,0); } } burndown(); }; const showHideTooltip = function(o,p){ if(o.get('currentSide') !== (p||{}).currentSide) { if( 0 === o.get('currentSide') ) { o.set({show_tooltip: true}); } else { o.set({show_tooltip: true}); o.set({show_tooltip: false}); } } }; checkInstall(); on('add:card',showHideTooltip); on('change:card',showHideTooltip); if('undefined' !== typeof TokenMod && TokenMod.ObserveTokenChange){ TokenMod.ObserveTokenChange(showHideTooltip); } }); (Coders note: Yes, I'm setting show_tooltip to true before then setting it to false.  This is a hack to work around the fact that merely setting it to false does not cause the setting to be updated.)
I tried this in one of my board games and it works great, thank you! One thing I noticed: If this script and TokenMod are running at the same time, tokenmod commands that flip cards or change image faces seem to be disabled.
1651072880
The Aaron
Roll20 Production Team
API Scripter
Hmm. Can you share the TokenMod command you're using?  It definitely isn't responding to TokenMod changes, I should add that. 
1651120964

Edited 1651120992
Sure, here's the one I tested! Just a simple "flip it messily into the discard pile" command. !token-mod --order tofront --set currentside|+1 rotation|+[[350+1d19]] left|+278
1651200876
The Aaron
Roll20 Production Team
API Scripter
Ok, I've adjusted the script above to also support TokenMod.