broadcast: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "<source" to "<syntaxhighlight") |
m (Text replacement - "<source" to "<syntaxhighlight") |
(No difference)
|
Latest revision as of 23:59, 14 March 2023
broadcast() Function
Note: This function can only be used in a Trusted Macro
• Introduced in version 1.3b77
Sends a message in the chat area to either all connected MapTool clients (default), or a subset of player names and/or keywords like
"gm"
given in a string list or JSON array. Broadcast does not display the sender's name or token image in front of the message.
The big differences between broadcast and a normal chat message are:
- if the message is part of a macro, then the message is sent even if the macro is aborted (after the broadcast),
- the message sender's name and token image are NOT displayed, and
- if you broadcast an execLink(), then that macro is AUTOMATICALLY executed on the clients it's broadcasted to, with the exception of the client that sends the message!
Usage
broadcast(message, [targets], [delimiter])
Parameters
message
- a message that is broadcasted to the users that are listed as parameters.targets
- a String list or JSON array of Player names, not Token names. Also recognizes: "gm", "gm-self", "self", "none", "all", "not-gm", "not-self", and "not-gm-self" as valid parameters. Defaults to all players (so if no parameter is given the message is send to all players). Note thattargets
is inclusive, so setting it to "not-gm, gm" will send the message to all connected players - all non-GMs and all GMs.delim
- The delimiter used to separate the values in the String List that is given, defaults to","
. If"json"
is specified, a JSON array is expected instead of a String List.
Examples
- Sending a message to all players:
[h: broadcast("Hello World")]
- Sending a message to all GMs only:
[h: broadcast("Hello World", "gm")]
- Sending a message to "tim" and "tom" only (default comma delimiter):
[h: broadcast("Hello World", "tim, tom")]
- Using json as the delimiter:
[h: broadcast("Hello World", '["tim", "tom"]')]
[h: broadcast("Hello World", json.append("", "tim", "tom"))]
- Executing the macro
update()
located atlib:Token
, for the tokenDragon
on the PC of userTim
:
[h: link = macroLinkText("update@Lib:Token", "none", "", "Dragon")]
[h: broadcast(execLink(link), "tim")]
Version Changes
- 1.5.5 - Added the
gm-self
,self
,all
, andnone
options totargets
. - 1.5.7 - Added the
not-gm-self
,not-self
, andnot-gm
options totargets
.