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 with sendChat error

Hi all, I am wondering why I got the following error when using api sendChat with inline roll: TypeError: Object 4 has no method 'replace' at _substituteShortForms ( here is a code snippet: test = function(){ var val = "[[10 + @{Spy|npc_perception}]]"; sendChat('', val, function(ops){ log(ops); }) } If I write [[10 + @{Spy|npc_perception}]] directly in chat, it work....
1427301990
The Aaron
Pro
API Scripter
Weird... I'll have to try that out and see if I get the same issue...
1427302389
The Aaron
Pro
API Scripter
Ok. Tried it. test = function(){ var val = "[[10 + @{Spy|npc_perception}]]"; sendChat('', val, function(ops){ log(ops); }) } on('ready',test); Added the on('ready',test); to cause it to execute on startup. I added a character names Spy with an npc_perception attribute and it worked fine for me. If I changed the name to a character that didn't exist, it definitely crashed, but with a different error. How are you activating this function? Maybe there is something else going on?