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

[Script] Wild Magic notify

1585657889

Edited 1585661055
After a long roll20 pause we started playing again and our Wild Mage always forgot to roll her wild magic surge. We've "made up" the rule to role the surge for every spell which needs a slot so I've made a little reminder script for her :) I also wanted to add auto rolling for the the surge & rollable table but she said that would take the fun out of it :P So now the Wild Mage who casts a spell larger than a cantrip gets a little reminder. on ( 'chat:message' ,  function  ( msg ) {      if  ( msg . playerid . toLowerCase () !=  "api"  &&   msg . rolltemplate ) {          message  =   msg . content          if  ( message . includes ( "level" )) {              var   level_pattern  =  /level (   ) ? =. * [ 0 - 9 ] / i ;              var   spellbase  =   msg . content . match ( level_pattern )[ 0 ];              var   spelllevel  =  parseInt ( spellbase . split ( "}" )[ 0 ]. substr ( -1 ));              if  ( spelllevel  >  0 ) {                  var   cnamebase  =   msg . content . split ( "charname=" )[ 1 ];                  var   cname  =  cnamebase  ?   cnamebase . replace ( / {{. * }} / ,  '' ). trim () : ( msg . content . split ( "{{name=" )[ 1 ] ||  '' ). split ( "{{" )[ 0 ]. trim ();                  var   character  =  cname  ?  findObjs ({                      name :  cname ,                      _type :  "character"                 })[ 0 ] :  undefined ;                  var   wildmagic  =  findObjs ({                      characterid :   character . get ( '_id' ),                      name :  "subclass" ,                      current :  "Wild Magic"                 });                  if  ( wildmagic . length ) {                      sendChat ( msg . who ,  "<div class='sheet-rolltemplate-simple' style='margin-top:-7px;'><div class='sheet-container'><div class='sheet-label' style='margin-top:5px;'><span>Wild Magic!<br>Roll your Destiny!<br></span></div></div></div>" );                 }             }         }     } });
1585665125
The Aaron
Roll20 Production Team
API Scripter
Cute!