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

sendChat and %{CharacterName|AbilityName}

1429478404

Edited 1429478431
The API wiki says that I can use sendchat to call %{CharacterName|AbilityName}. However, when I try: sendChat('character|' + characterId, '%{Knox Promethean|Dexterity_Save}') I get the following error: /home/symbly/www/d20-api-server/node_modules/firebase/lib/firebase-node.js:1 orts, require, module, __filename, __dirname) { function g(a){throw a;}var j=v ^ SyntaxError: Expected "[" or [ |\t] but "1" found. Any ideas?
it's a bug with the way the roll parser works in the API. I reported it a few days ago and was told that it would be fixed in the next release. <a href="https://app.roll20.net/forum/post/1832668/api-send" rel="nofollow">https://app.roll20.net/forum/post/1832668/api-send</a>... Basically, the character sheet has some extra white space after the '[[' in the roll save and the api's parser doesn't handle it properly. '&{template:5eDefault} {{character_name=@{character_name}}} {{save=1}} {{title=DEX saving throw}} {{subheader=@{character_name}}} {{rollname=DEX save}} {{roll=[[ 1d20 + @{dexterity_save_mod} + (@{global_saving_bonus}) ]]}} {{rolladv=[[ 1d20 + @{dexterity_save_mod} + (@{global_saving_bonus}) ]]}} @{classactiondexteritysave}' You can work around it by pre evaluating the variables in the API, then trimming the whitespace for every roll block, and then passing it to the sendChat function.
Gotcha! Thanks.