broadcast: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
(fixed template)
Line 96: Line 96:
[h: bot_execAllPlayer("update@lib:Token", json.append("","Hello World", 2), bot_all(), "all")]
[h: bot_execAllPlayer("update@lib:Token", json.append("","Hello World", 2), bot_all(), "all")]
</source><br />
</source><br />
}}

Revision as of 09:02, 16 December 2013

broadcast() Function

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

Introduced in version 1.3b77
This function lets send you a message directly to the chat area of another/all connected maptool clients. It does not display the senders name or token image in front of the message. It lets send you a message either to all or a list of players - use the player names or the keyword "gm". As delimiter you can specify either a string list separator character or "json" if you specify the target list as json array. The big difference between a 'normal' chat message is: 1. if the message is part of a macro then the message is send even if the macro is aborted(after the broadcast). 2. the sender of the message is NOT displayed and 3. if you broadcast an execLink() then that macro is AUTOMATICALLY executed on the clients its broadcasted to, with the exception to 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 - are the user names (so not token names) but the names of the users that are logged in. "gm" is also a valid parameter to give. E.g.: "tim, tom, tarra". Defaults to all players (so if no parameter is given the message is send to all players).
  • 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.

Example

*Sending a message to all players:
[h: broadcast("Hello World")]

  • Sending a message to gm only:
[h: broadcast("Hello World", "gm")]

  • Sending a message to tim and tom only:
[h: broadcast("Hello World", "tim, tom")]

  • Using the json as delimiter:
[h: broadcast("Hello World", '["tim", "tom"]')]

  • Executing the macro 'update()' located at 'lib:Token', for the token 'Dragon' on the PC of user 'Tim':
[h: link = macroLinkText("update@Lib:Token", "none", "", "Dragon")]
[h: broadcast(execLink(link), "tim")]