I believe the anonymous JavaScript that is being evaluated with lines numbered 468 and 452 is the generated character sheet script ( ChroniquesOubliees?). But there isn't any code that matches this error in the current version of that sheet on github, so maybe not? I find it doubtful that the problem is in there anyway, if I understood your post above correctly. You said you can run the entire template invocation by pasting to chat and it works, but if you run the same template through sendChat, it breaks? That suggests to me the different errors you are getting from different cases is because the parser has already derailed by the time it detects this error, so you are looking at nonsense error messages. If that is the case, I only have one random theory. Is there maybe a chance one of your international characters is being decoded/encoded incorrectly when passed through the API? I am grasping at straws, I know. But it might be good to rule this out. When you copy and paste your text to the chat, your stuff goes through content encoding via the client side and maybe that "cleans" something in there? I am suggesting some character in your query is being incorrectly encoded/decoded and you end up with junk in the query, throwing the parser off. To rule this out, just recreate the sendChat contents without any international characters and without copying and pasting the text you already have. Since you are pulling some of the content from the character attributes, you may add some code to strip any non-ASCII characters. You could for example have something that looks like 'a' but is really some crazy UTF-8 sequence that just happens to look like 'a' but breaks the parser. Ok, enough wild-ass theory. I have no evidence that this is correct, so please don't waste your time chasing it. I was intrigued by your weird error messages, and this is my initial 'feeling' of what it might be. Bon courage, Ammo PS: Maybe ask the authors of your character sheet what they think this is? Stéphane D said: Hello there Tried to go a different route with my script by making sure an attribute is created for the repeating section roll button field on the character sheet (was not the case prior to that). Then changed my script to sendChat() a command similar to %{character|repeating_section_$n_rollname} -- which works when issued directly in the chat window. This time the API console is showing this error message : ReferenceError: chracter is not defined
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:468:61)
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at eval (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:452:21)
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at Object.d20.textchat.doChatInput (eval at <anonymous> (/home/node/d20-api-server/api.js:155:1), <anonymous>:368:29)
at sendChat (/home/node/d20-api-server/api.js:1788:16)
at displayActions (apiscript.js:187:7)
at Object.apiCommand (apiscript.js:234:10) Sounds like a typo in some Roll20-owned .js script ? TIA