execFunction: Difference between revisions
m (Conversion script moved page ExecFunction to execFunction: Converting page titles to lowercase) |
m (Text replacement - "source>" to "syntaxhighlight>") |
||
Line 12: | Line 12: | ||
execFunction(functionName, arguments, defer, targets) | execFunction(functionName, arguments, defer, targets) | ||
execFunction(functionName, arguments, defer, targets, delim) | execFunction(functionName, arguments, defer, targets, delim) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|functionName|The function to "execute".}} | {{param|functionName|The function to "execute".}} | ||
Line 26: | Line 26: | ||
[h: song = "https://ia800300.us.archive.org/29/items/Muzyka-CC/Aleksand_Sjakin_-_Flight_in_space.mp3"] | [h: song = "https://ia800300.us.archive.org/29/items/Muzyka-CC/Aleksand_Sjakin_-_Flight_in_space.mp3"] | ||
[h: execFunction("playStream", json.append("[]", song, 1, 0.8), 0, "all")] | [h: execFunction("playStream", json.append("[]", song, 1, 0.8), 0, "all")] | ||
</ | </syntaxhighlight> | ||
|also= | |also= |
Revision as of 17:13, 14 March 2023
execFunction() Function
Note: This function can only be used in a Trusted Macro
Usage
<source lang="mtmacro" line> execFunction(functionName, arguments) execFunction(functionName, arguments, defer) execFunction(functionName, arguments, defer, targets) execFunction(functionName, arguments, defer, targets, delim) </syntaxhighlight> Parameters
functionName
- The function to "execute".arguments
- A JSON array of arguments for the function.defer
- Executes the function after the current macro has completed if non zero, defaults to zero.targets
- are the user names (so not token names) but the names of the users that are logged in. The options "gm", "gm-self", "self", "not-self", "not-gm", "not-gm-self", "none", and "all" are also valid parameters to give. E.g.: "tim, tom, tarra". Defaults to self (so if no parameter is given the function is executed locally only).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
<source lang="mtmacro" line> [h: song = "https://ia800300.us.archive.org/29/items/Muzyka-CC/Aleksand_Sjakin_-_Flight_in_space.mp3"] [h: execFunction("playStream", json.append("[]", song, 1, 0.8), 0, "all")]
</syntaxhighlight>See Also
Notes
Deferred functions/links which are queued within a deferred macro do not run directly after the queuing macro, but instead is added to the end of the stack of all the deferred functions and links. This means you cannot 'nest' deferrals or insert deferrals in the middle of the stack of deferred macros. For discussion of this functionality and possible workarounds you can read more on GitHub.