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

Whispering a spell cast from a macro button

I've been working on getting better with the Roll20 macro system this weekend, and I'm finding myself a bit stuck on one thing. I'm using the following macro (credit to Kurt, posted in the comments of a YouTube video): /w gm @{wtype} &amp;{template:default}{{name=@{selected|character_name} Cantrips}} {{Spell Save DC @{selected|spell_save_dc}= +@{selected|spell_attack_bonus} to hit with spell attacks}} {{At Will= [@{repeating_spell-Cantrip_$3_spellname}](~selected|repeating_spell-Cantrip_$3_spell) [@{repeating_spell-Cantrip_$4_spellname}](~selected|repeating_spell-Cantrip_$5_spell) [@{repeating_spell-Cantrip_$5_spellname}](~selected|repeating_spell-Cantrip_$5_spell) [@{repeating_spell-Cantrip_$6_spellname}](~selected|repeating_spell-Cantrip_$6_spell) [@{repeating_spell-Cantrip_$7_spellname}](~selected|repeating_spell-Cantrip_$7_spell) }} I've successfully imported a creature from the 5e SRD and have implemented this to give me a lovely "Cantrips" button when the creature's token is selected. Clicking it gives me a beautiful gm-whispered list of buttons I can click on. However, when I click them, they post the roll to public chat, and I can't figure out how to make it whisper the spell to the GM only. Have tried many variations of the syntax, and inserting /w gm in various places. I even found some forum threads like the one linked below that look similar. This one appears to have been solved by inserting the ASCII code for a carriage return. I'm at a loss though for how to do this in the context of this macro. Thanks in advance for any help! <a href="https://app.roll20.net/forum/post/6640801/nesting-macros-issue" rel="nofollow">https://app.roll20.net/forum/post/6640801/nesting-macros-issue</a>
1562544225

Edited 1562544711
The Aaron
Roll20 Production Team
API Scripter
That inserting of a carriage return is from before there was the ~ operator, so you had to do: [@{repeating_spell-Cantrip_$3_spellname}](!&amp;#13;@{selected|repeating_spell-Cantrip_$3_spell}) instead of: [@{repeating_spell-Cantrip_$3_spellname}](~selected|repeating_spell-Cantrip_$3_spell) to get a button that would call a macro or whatever. Probably the NPC is not set up to whisper output.&nbsp; That @{wtype} would resolve to either "" or "/w gm " or the like based on the setting of the character.&nbsp; You can find it in the Gear on the character: If you want to set this globally, you'd need to set the default on the Game Settings under Character Sheet: Then Apply Default Settings on the Gear tab of the game:
Nailed it. I never would have guessed it was that, I was certain I was missing something syntax-wise and was just poring over the macro docs scratching my head. Just changed it to "Always Whisper Rolls" as you showed above and that did it. Thanks once again man!
1562545748

Edited 1562545769
The Aaron
Roll20 Production Team
API Scripter
I wrote this quick script to manipulate massive amounts of characters.&nbsp; You can call it to change npcs or pcs (where pcs have something in controlled by, and npcs do not): !set-wtype --npcs --whisper Possible options are: Who to effected: --npcs --pcs --all What to set: --whisper --public Code: on('ready',()=&gt;{ const setWTypeByClass = (type, value) =&gt; { let filter = () =&gt; true; switch(type.toLowerCase()){ default: case 'npcs': filter=(c)=&gt; 0 === c.get('controlledby').length; break; case 'players': filter=(c)=&gt;c.get('controlledby').length&gt;0; break; case 'all': break; } let chars = findObjs({ type: 'character' }).filter(filter); let charCount = chars.length; const burndown = () =&gt; { if(chars.length) { let c = chars.shift(); let a = findObjs({ type: 'attribute', name: 'wtype', characterid: c.id })[0]; if(a) { a.set({ current: value }); } setTimeout(burndown,0); } else { sendChat('',`/w gm Set ${charCount} character(s) to ${value||'public'}`); } }; burndown(); }; on('chat:message',(msg)=&gt;{ if('api' === msg.type &amp;&amp; /!set-wtype\b/i.test(msg.content)){ let args = msg.content.split(/\s+/).map(s=&gt;s.toLowerCase()); let type = 'npcs'; let value = '/w gm '; if(args.includes('--npcs') || args.includes('--npc')){ type = 'npcs'; } else if(args.includes('--pcs') || args.includes('--pc') || args.includes('--players') || args.includes('--player') ){ type = 'players'; } else if(args.includes('--all') ){ type = 'all'; } if(args.includes('--whisper') || args.includes('--w') ) { value = '/w gm '; } else if( args.includes('--public') || args.includes('--loud') ) { value = ''; } setWTypeByClass(type,value); } }); });
Awesome, thank you! This is fantastic.