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

[HELP] Send whisper to player as a character

Hi, I have a character with a sentient weapon that only he can hear. I was hoping to use the API to hook into the chat and send messages from the weapon to the character. The weapon's sentience has a character sheet, I just don't want to have to constantly change the 'As' dropdown and was also hoping to be able to stype the message in a popup display. So the macros currently looks like this but I still need to change the 'As option in chat when running it - /w "Saerynn Falblood" Hugins cawing catches your attention "?{Message?}" Thanks!
You can use this Stupid Trick to only whisper to characters who control the Sentient Weapon.  If you want an API in combination with this, the emas script will do what you're looking for.
And I remembered that I had to modify the emas script a bit, because it wasn't changing the 'speaking as' for whispers. But you should be able to add this to the emas script (just below the !w section... about line 176): /* Code to add whispering from Spiritual Weapon  */             case '!whisperas':                 var whisperAsArgs = msg.content.slice(11).split(" --");                 var fromNameAs = whisperAsArgs[0];                 var toNameAs = whisperAsArgs[1];                 var whisperAsMessage = whisperAsArgs[2]; if(1 === args.length) { showHelp(who); }                  else if(playerIsGM(msg.playerid)) { sendChat(`${fromNameAs}`,`/w "${toNameAs}" ${whisperAsMessage}`); sendChat(`${fromNameAs}`,`/w gm [To ${toNameAs}] ${whisperAsMessage}`); } else {     sendChat(`Whisper Script`,`/w "${who}" You are not the GM!`);         } break; // END OF NEW CODE  The command is (remove all the < >): !whisperas <Name of Speaker> --<Name of recipient> --<Message>  So you could add a Token Action to 'Hugins' or create yourself a macro: !whisperas Hugins --Saerynn Falblood --?{Message}  You have to make sure that the character names are spelled exactly, and there's probably a more elegant, streamlined way of doing that, but my javascript skills are pretty rudimentary. :)