js:MapTool.chat: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
m (Split out all three functions; add explanatory text; fix typos)
Line 6: Line 6:
|trusted=true
|trusted=true
|version=1.10.0
|version=1.10.0
|description=
|description=Like the {{func|broadcast}} macro.
Like the {{func|broadcast}} macro.


|usage=
|usage=
<syntaxhighlight lang="javascript" line>
<syntaxhighlight lang="javascript" line>
MapTool.chat.broadcast(msg);
MapTool.chat.broadcast(msg);
MapTool.chat.broadcast(lstOfPlayers, msg);
</syntaxhighlight>
</syntaxhighlight>


'''Parameters'''
'''Parameters'''
* {{code|msg}} String to send
* {{code|msg}} String to send to all players and GMs.
* {{code|lstOfPlayers}} An array containing the names of the players to include
}}


{{MacroFunction
|name=chat.broadcastTo
|trusted=true
|version=1.10.0
|description=Like the {{func|broadcast}} macro when used to send just to a particular list of connected machines.
|usage=
<syntaxhighlight lang="javascript" line>
MapTool.chat.broadcastTo(lstOfPlayers, msg);
</syntaxhighlight>


'''Parameters'''
* {{code|msg}} String to send to all players and GMs.
* {{code|lstOfPlayers}} An array containing the names of the players to send the message to.
}}
}}
{{MacroFunction
{{MacroFunction
|name=chat.broadcastToGM;
|name=chat.broadcastToGM
|trusted=true
|trusted=true
|version=1.10.0
|version=1.10.0
|description=
|description=Like the {{func|broadcast}} macro, but only sends to GMs.
Like chat.broadcast, but only includes GMs.


|usage=
|usage=
Line 34: Line 45:


'''Parameters'''
'''Parameters'''
* {{code|msg}} String to send
* {{code|msg}} String to send to all GMs.
 
 
 
}}
}}


<h3>See Also</h3>
== See Also ==
 
{{func|js:MapTool}}
[[js:MapTool|JS: MapTool]]<br/>
[[Category:Javascript Function]]
[[Category:Javascript Function]]

Revision as of 04:05, 7 June 2023

 This article describes a feature or macro function that is experimental and may be subject to change.

Within the javascript environment used by js.eval, MapTool.chat is the entry point for sending chat messages. This page details the attributes and functions available on the MapTool.chat object.


chat.broadcast() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.10.0
Like the broadcast() macro.

Usage

MapTool.chat.broadcast(msg);

Parameters

  • msg String to send to all players and GMs.


chat.broadcastTo() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.10.0
Like the broadcast() macro when used to send just to a particular list of connected machines.

Usage

MapTool.chat.broadcastTo(lstOfPlayers, msg);

Parameters

  • msg String to send to all players and GMs.
  • lstOfPlayers An array containing the names of the players to send the message to.


chat.broadcastToGM() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.10.0
Like the broadcast() macro, but only sends to GMs.

Usage

Maptool.chat.broadcastToGM(msg)

Parameters

  • msg String to send to all GMs.


See Also

js:MapTool()