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

New to API Scripting and Need Help! (API Image to Chat)

1491417099

Edited 1491418915
Anyone know how I can make this script remove the msgWho tag that appears in the chat box? Looking to be able to remove the player 'name as' stamp that shows up in chat. See above shown as "Master MJ (GM):" after the Image emote. If you remove the msgWho from the sendChat code, the script will not work anymore.  Anyway to add code or remove code to solve this issue? code: on("chat:message", function (msg) { var cmdName = "!pic "; var msgTxt = msg.content; var msgWho = msg.who; var piclink = msgTxt.slice(cmdName.length); if (msg.type == "api" && msgTxt.indexOf(cmdName) !== -1) { log(piclink); sendChat(msgWho, '/direct <b><u>shared:<img src="' + piclink + '">'); }; });
1491418371
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Just remove msgwho from the start of the sendChat: code: on("chat:message", function (msg) { var cmdName = "!pic "; var msgTxt = msg.content; var piclink = msgTxt.slice(cmdName.length); if (msg.type == "api" && msgTxt.indexOf(cmdName) !== -1) { log(piclink); sendChat( '' , '/direct <b><u>shared:<img src="' + piclink + '">'); }; }
When I paste your code in it give me this. Your scripts are currently disabled due to an error that was detected. Please make appropriate changes to your scripts and click the "Save Script" button and we'll attempt to start running them again. More info... For reference, the error message generated was: SyntaxError: Unexpected identifier
Got it figure out.  Thanks for the help. code: on("chat:message", function (msg) { var cmdName = "!pic "; var msgTxt = msg.content; var piclink = msgTxt.slice(cmdName.length); if (msg.type == "api" && msgTxt.indexOf(cmdName) !== -1) { log(piclink); sendChat('', '/direct <b><u>shared:<img src="' + piclink + '">'); }; });
1491427399
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Good to hear.