
If you've ever wished your players could click a button to send a ping and center their view on their character's token, this video will show you how - https://youtu.be/qqCk0sKYhr4
If you've ever wished your players could click a button to send a ping and center their view on their character's token, this video will show you how - https://youtu.be/qqCk0sKYhr4
@Nick, I'm missing something. The characterList is empty. I get "Which character?" but no chat menu buttons.
I got it to work. I created a new game with just a few tokens. My other game must have some inconsistencies. I did notice, however, that if the playerName has a space, it should be quoted. I added backslash quotes (\") before and after playerName.
sendChat("PingMeAPI","/w \"" + playerName + "\" Which character?<br/>"+pingList);^ ^
Crimson Prime said:
I got it to work. I created a new game with just a few tokens. My other game must have some inconsistencies. I did notice, however, that if the playerName has a space, it should be quoted. I added backslash quotes (\") before and after playerName.
sendChat("PingMeAPI","/w \"" + playerName + "\" Which character?<br/>"+pingList);^ ^
In Javascript, you can use different quote types to nest quotes within a string, like
sendChat("PingMeAPI",'/w "' + playerName + '" Which character?<br/>'+pingList);
You can also use string literal (aka template literal) syntax which uses the weird backticks (`), and then nest code within ${}, like so
sendChat("PingMeAPI",`/w "${playerName}" Which character?<br/>`+pingList);
The latter seems clunky at first, but the more you use, the more you appreciate how powerful and flexible it is.
@Crimson - thanks for pointing that out, I'll update the code to account for the spaces in the player's name
@Gold - glad you like them!
@GiGs - I didn't know about string literals before - those are definitely the way to go. Thanks!