Character Vault
Any Concept / Any System
Compendium
Your System Come To Life
Roll20 for Android
Streamlined for your Tablet
Roll20 for iPad
Streamlined for your Tablet

Personal tools

Difference between revisions of "Script:Interpreted sendChat"

From Roll20 Wiki

Jump to: navigation, search
(Created page with "{{stub}}")
 
m (add category)
 
(6 intermediate revisions by one user not shown)
Line 1: Line 1:
{{stub}}
+
{{script overview
 +
|name=Interpreted sendChat
 +
|author={{user profile|235259|Brian}}
 +
|version=2.2
 +
|lastmodified=2016-03-09
 +
|dependencies={{api repository link|levenshteinDistance}}
 +
}}
 +
 
 +
'''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 <code>sendChat</code> 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 ===
 +
{{syntaxbox top|nocat=true}}
 +
bshields.sendChat(''msgObj'', ''message'')
 +
{{syntaxbox end}}
 +
 
 +
==== Parameters ====
 +
;msgObj
 +
:The original message object given as a parameter to a <code>chat:message</code> event's callback.
 +
;message
 +
:The message to send to the chat. This can be any message you could normally send to <code>sendChat</code>, including using commands such as <code>/direct</code>
 +
 
 +
=== Example ===
 +
<pre data-language="javascript">
 +
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
 +
    }
 +
});
 +
</pre>
 +
 
 +
=== Changelog ===
 +
{{changelog version|2.2|2016-03-09|* Update for one-click install}}
 +
{{changelog version|2.1|2015-01-13|* [bugfix] Fixed syntax & logical bug}}
 +
{{changelog version|2.0|2015-01-08|* Release}}
 +
 
 +
[[Category:API Meta Scripts]]

Latest revision as of 14:16, 4 January 2022

API ScriptAuthor: Brian
Version: 2.2
Last Modified: 2016-03-09
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.

Contents

[edit] Syntax

bshields.sendChat(msgObj, message)

[edit] 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

[edit] 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
    }
});

[edit] Changelog

v2.2 (2016-03-09)

  • Update for one-click install


v2.1 (2015-01-13)

  • [bugfix] Fixed syntax & logical bug


v2.0 (2015-01-08)

  • Release