execFunction: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(Created page with "{{MacroFunction |name=execFunction |version=1.5.7 |trusted=true |description= Executes a function with no output on other clients. {{func|execFunction}} allows you to defer th...")
 
No edit summary
Line 20: Line 20:
{{param|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).}}
{{param|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).}}
{{param|delim|The delimiter used to separate the values in the String List that is given, defaults to {{code|","}}. If {{code|"json"}} is specified, a JSON array is expected instead of a String List.}}
{{param|delim|The delimiter used to separate the values in the String List that is given, defaults to {{code|","}}. If {{code|"json"}} is specified, a JSON array is expected instead of a String List.}}
|example=
To run a song on very client, the GM can use
<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")]
</source>


|also=
|also=

Revision as of 08:17, 21 October 2019

execFunction() Function

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

Introduced in version 1.5.7
Executes a function with no output on other clients. execFunction() allows you to defer the running of the link until after the currently running macro has ended. If you defer a series of links, they will be queued in order and executed after the currently running macro.

Usage

execFunction(functionName, arguments)
execFunction(functionName, arguments, defer)
execFunction(functionName, arguments, defer, targets)
execFunction(functionName, arguments, defer, targets, delim)

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

To run a song on very client, the GM can use
[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")]

See Also