You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: js/Documentation.md
+108-8Lines changed: 108 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ Each handler provides its own triggers and actions that can be used in a trigger
6
6
-[General](#general)
7
7
*[Case Sensitivity](#case-sensitivity)
8
8
*[Quotes](#quotes)
9
+
*[Multi-line Inputs](#multi-line-inputs)
9
10
*[Comments](#comments)
10
11
*[Parameters](#parameters)
11
12
*[Aliases](#aliases)
@@ -285,6 +286,7 @@ Each handler provides its own triggers and actions that can be used in a trigger
285
286
+[OnTWUnban](#ontwunban)
286
287
*[Actions](#twitch-actions)
287
288
+[Twitch AddBlockedTerm](#twitch-addblockedterm)
289
+
+[Twitch AdSchedule](#twitch-adschedule)
288
290
+[Twitch Announcement](#twitch-announcement)
289
291
+[Twitch Auth](#twitch-auth)
290
292
+[Twitch Authenticate](#twitch-authenticate)
@@ -432,6 +434,46 @@ OBS Scene "Starting Soon"
432
434
433
435
***
434
436
437
+
### Multi-line Inputs
438
+
As of Kruiz Control v2.0.6, the inputs to triggers and actions can be split over multiple lines. For example, the below action provides a [`Function`](#function) input via multiple lines.
439
+
```
440
+
OnInit
441
+
Function "
442
+
var data = 4;
443
+
return { value: data * 2 };
444
+
"
445
+
Error {data}
446
+
```
447
+
448
+
_Note: While an individual input can be multiple lines, inputs cannot be distributed over multiple lines._
449
+
450
+
The below events are **NOT** valid.
451
+
452
+
```
453
+
# Invalid because the inputs are provided on the following lines.
454
+
OnInit
455
+
Random
456
+
"Chat Send 'Option 1'"
457
+
"Chat Send 'Option 2'"
458
+
459
+
# Invalid because the first input ends on the first line.
460
+
# The second option will be skipped.
461
+
OnInit
462
+
Random "Chat Send 'Option 1'"
463
+
"Chat Send 'Option 2'"
464
+
```
465
+
466
+
The below is technically valid, albeit funky looking. As long as a quote is not terminated until the following line, it will be parsed as a multi-line input.
467
+
468
+
```
469
+
# Since the end double quote for the first input is on the second line, the second line is included when processing the action.
470
+
OnInit
471
+
Random "Chat Send 'Option 1'
472
+
" "Chat Send 'Option 2'"
473
+
```
474
+
475
+
***
476
+
435
477
### Comments
436
478
Trigger files support comments using the **#** character. This allows you to leave text in the trigger file that is not treated as a trigger or action.
437
479
@@ -1432,16 +1474,53 @@ A small selection of actions that are included for increased usability.
`<function>` is a javascript function body. For reference, please see this [documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/Function). If the function returns an object, each property of the Object is usable as a parameter in the rest of the trigger.
1477
+
`<function>` is a javascript function body. For reference, please see this [documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/Function).
1478
+
1479
+
If the function returns an object, each property of the Object is usable as a parameter in the rest of the trigger.
1480
+
1481
+
- If a `continue` parameter is returned and the value is `false`, the trigger will exit and not continue processing actions.
1482
+
1483
+
- If an `actions` array parameter is returned, each item of the array will be inserted into the event and processed.
1484
+
1485
+
##### Example Usage
1486
+
1487
+
<table>
1488
+
<tr>
1489
+
<td>The below returns a random element from an array in <code>api_data</code>.</td>
1490
+
</tr>
1491
+
<tr>
1492
+
<td>
1436
1493
1437
-
The below returns a random element from an array in _api_data_.
1438
-
```js
1494
+
```m
1439
1495
Function 'var arr = [api_data]; return {random: arr[Math.floor(Math.random() * arr.length)]}'
1440
1496
```
1441
1497
1442
-
If a `continue` parameter is returned and the value is `false`, the trigger will exit and not continue processing actions.
1498
+
</td>
1499
+
</tr>
1500
+
</table>
1501
+
1502
+
<table>
1503
+
<tr>
1504
+
<td><em>Note: As of Kruiz Control v2.0.6, multi-line inputs are now supported.</em>
1443
1505
1444
-
If an `actions` array parameter is returned, each item of the array will be inserted into the event and processed.
1506
+
The above example can be rewritten as the multi-line <code>function</code> below.</td>
@@ -1509,7 +1588,7 @@ The following `<comparator>` values are valid: `=`, `<`, `>`, `<=`, `>=`, `!=` (
1509
1588
1510
1589
Multiple comparisons can be combined in one **If** line using the following `<conjunction>` values: `and`, `or`.
1511
1590
1512
-
The `<optional_skip>` value allows you to specify the number of lines to skip if the criteria is not met. This value is completely optional and allows for advanced logic handling.
1591
+
The `<optional_skip>` value allows you to specify the number of lines to skip if the criteria is not met. This value is completely optional and allows for advanced logic handling. When skipping lines, multi-line inputs are considered one line and comments are not considered.
1513
1592
1514
1593
1515
1594
|||
@@ -1547,7 +1626,7 @@ The `<optional_skip>` value allows you to specify the number of lines to skip if
1547
1626
#### Loop
1548
1627
|||
1549
1628
------------ | -------------
1550
-
**Info** | Used to repeat a set of actions a specified number of times. `<lines>` is the number of actions/lines to repeat. `<times>` is the number of times to repeat the actions/lines.
1629
+
**Info** | Used to repeat a set of actions a specified number of times. `<lines>` is the number of actions/lines to repeat. When counting lines, multi-line inputs are considered one line and comments are not considered. `<times>` is the number of times to repeat the actions/lines.
1551
1630
**Format** | `Loop <lines> <times>`
1552
1631
**Example** | `Loop 8 10`
1553
1632
@@ -1589,7 +1668,7 @@ The `<optional_skip>` value allows you to specify the number of lines to skip if
1589
1668
#### Skip
1590
1669
|||
1591
1670
------------ | -------------
1592
-
**Info** | Used to skip over the next `<number>` of lines in an event.
1671
+
**Info** | Used to skip over the next `<number>` of lines in an event. When skipping lines, multi-line inputs are considered one line and comments are not considered.
1593
1672
**Format** | `Skip <number>`
1594
1673
**Example** | `Skip 3`
1595
1674
@@ -3860,6 +3939,26 @@ _Note: Bit voting is not currently supported, however Twitch provides these valu
0 commit comments