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

Hidden Whispers (Update Help)

A few months ago, I got some help creating a script to send hidden messages including rolls to the gm. (Hidden Rolls Post) I have since tried to use this in combination with roll templates and it seems to fail. Instead of displaying the roll template in whisper to the gm. It just displays the raw text of the template. I have no idea how to update this I was wondering if someone might be able to assist in getting it to work. on("chat:message", function(msg) { var cmdName = "!bw"; var msgWhisper = msg.content.slice(cmdName.length); if(msg.type == "api" && msg.content.indexOf(cmdName) !== -1) { if(_.has(msg,'inlinerolls')){ msgWhisper = _.chain(msg.inlinerolls) .reduce(function(m,v,k){ m['$[['+k+']]']=v.results.total || 0; return m; },{}) .reduce(function(m,v,k){ return m.replace(k,v); },msgWhisper) .value(); } sendChat('', "/w gm "+msgWhisper); }; }); !bw &{template:35Adv_AtkInfo} {{name=Alastair}} {{type=Earth Pony}} {{subtype=Vampire}} {{ac=22}} {{touch=13}} {{ff=21}} {{dr=DR 5/Magic or Silver}} {{immunities=Abil/En Drain, Death & Necromancy, Sleep}} {{vulnerabilities=Sunlight, Running Water}} {{material=}} {{thickness=0}} {{material_hp=(0*0)}} {{disable_dc=0}} {{break_dc=0}} {{notes=Notes}} When I use it with a roll template this is what is whispered to the GM: (From ): &{template:35Adv_AtkInfo} {{name=Alastair's}} {{type=Earth Pony}} {{subtype=Vampire}} {{ac=22}} {{touch=13}} {{ff=21}} {{dr=DR 5/Magic or Silver}} {{immunities=Abil/En Drain, Death & Necromancy, Sleep}} {{vulnerabilities=Sunlight, Running Water}} {{material=}} {{thickness=0}} {{material_hp=(0*0)}} {{disable_dc=0}} {{break_dc=0}} {{notes=Notes}}
1431137419

Edited 1431212140
Testing with one of my scripts would suggest that sendChat's handling of templates isn't fleshed out yet. Using the default template, the "&{template:default}" part of the message was consumed in my testing, leaving only the various {{foo=bar}} parts behind in the displayed message.
1431231275

Edited 1431231297
Actually, further testing shows that the chat system strips out the "&{template:...}" before it gets passed along to scripts. I've updated my affected scripts to do a replace(/&/g, "&") on the command, so roll templates can be used by entering "&{template:...}".
Is there any chance you could tinker with the above script so that it will work? I fear I dont have any skill with scripting.
1431232781

Edited 1431264098
The Aaron
Pro
API Scripter
It will probably work if you use this fire the sendChat: sendChat('', '/w gm '+msgWhisper.replace(/&/g,'&') ); and issue the command like this: !bw &{template:35Adv_AtkInfo} {{name=Alastair}} {{type=Earth Pony}} {{subtype=Vampire}} {{ac=22}} {{touch=13}} {{ff=21}} {{dr=DR 5/Magic or Silver}} {{immunities=Abil/En Drain, Death & Necromancy, Sleep}} {{vulnerabilities=Sunlight, Running Water}} {{material=}} {{thickness=0}} {{material_hp=(0*0)}} {{disable_dc=0}} {{break_dc=0}} {{notes=Notes}}
1431235347

Edited 1431235821
Toby
Pro
Alright, thank you Aaron and manveti. The code does not like sendChat('', '/w gm '+msgWhisper.replace(/&/g,'&') ); so I tried sendChat('', '/w gm '+msgWhisper.replace(/&/g,'&') ); And it liked it. Unfortunately, that means I cant call a this roll template from a macro because the macro itself strips out the "&" Grrrrr.. ------------ Edit: I am a complete doofus... I'll just put the !bw inside the macro itself and call it with #macroname.... duh.
1431264164
The Aaron
Pro
API Scripter
Ah, forgot to double replace my HTML Entity, fixed the above message. Glad ad you got it working!