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

Post text while a player or an enemy casts a spell

As in title, I bought the digital package of the deck of many and would like to create an API to post text of the GIF I have on giphy when a specific spell is cast. Is there someone who could point me in the right direction? Maybe there is a script I can rewrite that behaves similiarily?
1611985250
Oosh
Sheet Author
API Scripter
Customizable roll listener could achieve that. If you don't need it to do anything else, you could also write a pretty short and simple script to handle it yourself if you prefer... it would look something like this: on('ready', () =&gt; { on('chat:message', (msg) =&gt; { if (msg.template.match(/spellTemplateName/i) &amp;&amp; msg.content.match(/spellName/i)) { sendChat('', `[img](<a href="http://www.imagehost.com/example.gif)`" rel="nofollow">www.imagehost.com/example.gif)`</a>); } }); }); If you're likely to add more events to it later, probably best to stick with CRL than reinventing the wheel, though.
1611999688
Oosh
Sheet Author
API Scripter
Marjorie B. said: Consider using polymorphism. If you have a virtual function&nbsp; doSpellEffects , you can implement "usual" logic in the base class, and more specialized logic in other classes for specific spells or spell categories. I hope that one day in the future, the internet will be 99% bot traffic, and it will be OUR turn to try to sneak some human posts onto a bot forum and have it pass for bot-drivel. They'll never know I'm a meatbag!
1612013816
David M.
Pro
API Scripter
Lol! But yeah, seems like a big uptick in bots on this forum lately.&nbsp;
im such a noob i thought it was just i didnt understand!
If I were to post a gif for "dancing lights" what will be the difference between spell template and spell name?
1612135386
Oosh
Sheet Author
API Scripter
It depends on the character sheet you're using - is it R20's 5e sheet, or something else? Basically you want the msg.template match in there to make sure no one triggers the script by just posting the name of the spell in chat. Then the msg.content match stops the script triggering on any spell. The msg.content match can be made more accurate than just the spell name depending (again) on the character sheet in use. You can potentially make the msg.content match specific enough that the template one is superfluous - need to know which sheet you're using though.
1612160446

Edited 1612162153
Victor B.
Pro
Sheet Author
API Scripter
If you want to track spells, Combat Master does that and can send a message when spell is cast.&nbsp; Gifs requires a bit more work due to roll20.&nbsp; Not as easy as you want.&nbsp; Do you want a message or an interactive image?:&nbsp; TheAarron has something to deal with animated or non-animated GIFs.&nbsp;&nbsp;
I have managed to achieve everything using CRL - topic can be closed