Queued Conditional Output
Requires MapTool 1.3b55
The following is a user defined function that allows you to queue output to various recipients. All of the queued output is then displayed to the intended recipient/s after the completion of the current macro.
Usage
Parameters:
-
who - Expects a string containing the recipient/s; this string can be 'self', 'gm', 'gm-self', or a JSON array of player names(e.g. '["Bob","Joe"]').
-
what - Expects a string that contains the output; it is sent to the recipient as plain text, so HTML code works as intended.
Notes
- When sending to a specific list of recipients, the output comes across as a whisper; that's just the way it is.
- Currently there is no error checking, if you want/need error checking, it shouldn't be hard to implement.
- There is theoretically no limit to the amount of outputs you can queue, but like any software your hardware will impose its own limits.
Macros
Place the following macros all on the same library token(or on different library tokens if you know what you're doing and what to change).
onCampaignLoad
[defineFunction('outputTo', 'outputTo@this')]
outputTo
[h: toSend = '{}']
[h: argTest = json.type(arg(0))]
[h, if(argTest=='ARRAY'), code:
{
[h: toWho = 'list']
[h: toSend = json.set(toSend, 'mlOutputList', arg(0))]
};{
[h: toWho = arg(0)]
}]
[h: toSend = json.set(toSend, 'toSend', arg(1))]
[h: conditionalOutput = macroLinkText('conditionalOutput@this', toWho, toSend)]
[h: execLink(conditionalOutput, 1)]
conditionalOutput
[r: json.get(macro.args, 'toSend')]
See Also
macroLinkText,
execLink
Library Token: A special token designed to hold a library of macros (similar to a function library) that can be called by token macros, campaign macros, and global macros. Often called "Lib:tokens."Token: A visual marker representing a character, monster, or NPCCampaign Macro: A macro specific to a campaign file. These macros are available to players and the GM, and are displayed in the Campaign Macros window.Global Macro: Macros that are available regardless of the campaign file currently loaded in MapTool, and regardless of whether the instance of MapTool is a server or a client. Global macros are ''only'' available to the running instance.Trusted Macro: A macro run from a Library token or run by the GM, that cannot be edited by a player.Macro: A series of text instructions used to automate processes in MapTool.Campaign: A zipped XML file with the '''.cmpgn''' file extension containing tokens, maps, token macros, campaign macros, and token propertiesMap: An image file displayed in the map display area in MapTool. This image is shared among all connected players and the GM.