Difference between revisions of "Script:Interpreted sendChat"
From Roll20 Wiki
m |
|||
Line 2: | Line 2: | ||
|name=Interpreted sendChat | |name=Interpreted sendChat | ||
|author={{user profile|235259|Brian}} | |author={{user profile|235259|Brian}} | ||
− | |version=2. | + | |version=2.1 |
|lastmodified=2015-01-08 | |lastmodified=2015-01-08 | ||
|dependencies={{api repository link|levenshteinDistance}} | |dependencies={{api repository link|levenshteinDistance}} |
Revision as of 16:54, 13 January 2015
API ScriptAuthor: Brian
Version: 2.1
Last Modified: 2015-01-08
Code: Interpreted sendChat
Dependencies: levenshteinDistance
Conflicts: None
Version: 2.1
Last Modified: 2015-01-08
Code: Interpreted sendChat
Dependencies: levenshteinDistance
Conflicts: None
Interpreted sendChat is designed to assist other scripts in handling message output. When a script needs to send a message to chat (normally handled with the native sendChat
function) as though the message is being sent by the same player or character who triggered the chat message event, Interpreted sendChat may be used.
Syntax
bshields.sendChat(msgObj, message)
Parameters
- msgObj
- The original message object given as a parameter to a
chat:message
event's callback. - message
- The message to send to the chat. This can be any message you could normally send to
sendChat
, including using commands such as/direct
Example
on('chat:message', function(msg) { if (msg.type === 'api') { bshields.sendChat(msg, 'I used an api command!'); // If player Brian is speaking out of character, the message will be sent as Brian // If player Brian is speaking as the character Barases, the message will be sent as Barases } });