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: streamerbot/2.guide/03.variables.md
+41-31Lines changed: 41 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,9 +4,9 @@ description: Usage of arguments and variables in your Streamer.bot actions
4
4
---
5
5
6
6
## Introduction
7
-
When a trigger executes an action, it will automatically generate a set of variables specific to that event source and make them available to that action via the **argument stack**. You can use subsequent sub-actions to populate additional arguments, or even manipulate existing arguments on the stack.
7
+
When a trigger executes an action, it will automatically generate a set of variables specific to that event source and type, and make them available to that action via the **argument stack**. You can use subsequent sub-actions to populate additional arguments, or even to manipulate existing arguments on the stack.
8
8
9
-
Arguments only persist until the called actionfinishes execution and can not be referenced by any other action. To share variables across multiple actions, or to persist them across restarts, you can store them as [Global Variables](#global).
9
+
Arguments only exist within the scope of the current action. Once the action finishes execution, they can not be referenced by any other action. To share variables across multiple actions, or to persist them across restarts, you can store them as [Global Variables](#global-variables).
10
10
11
11
::read-more{to=/api/triggers}
12
12
Explore all available triggers and their variables in the [Triggers API References](/api/triggers)
@@ -24,12 +24,12 @@ These variables can be utilized in most [sub-action](/guide/actions#sub-actions)
24
24
25
25
{caption-alt}
26
26
27
-
To use a variable from the current argument stack, wrap the variable name with `%` symbols:
27
+
To replace a variable name with its value from the current argument stack, wrap the variable name with `%` symbols:
28
28
29
29
`%userName%`{lang=cs}
30
30
31
31
::tip
32
-
Variables are added onto the argument stack during sequential execution of each sub-action. If you are testing and a variable seems to be missing, ensure that you are testing at the correct point of execution!
32
+
Variables are added to the argument stack by each sub-action, which execute sequentially. If you are testing and a variable seems to be missing, ensure that the sub-action which sets it runs *before* you're attempting to access it!
33
33
::
34
34
35
35
::read-more{to=#inspecting-arguments}
@@ -39,25 +39,35 @@ Read more about how to **inspect arguments** after an action has executed
39
39
### Global Variables
40
40
Global variables allow you to share data between multiple actions, or even persist it across multiple restarts of Streamer.bot.
41
41
42
-
To quickly access a global variable, wrap the variable name with `~` symbols:
To access the value of a global variable in your action, you **must *first*** assign it to a local variable with the `Get Global Variable` sub-action
49
+
::
43
50
44
-
`~myGlobalVariable~`{lang=cs}
51
+
To directly access the value of a ***persisted* global variable**, wrap the variable name with `~` symbols:
52
+
53
+
`~myPersistedGlobalVariable~`{lang=cs}
45
54
46
55
::tip
47
-
This syntax currently only works for **persisted** global variables, and **not** user variables.
56
+
This syntax currently *only* works for **persisted** global variables, and **not** user global variables.
48
57
::
49
58
50
-
::read-more{to=#inspecting-arguments}
51
-
Read more about how to use the variable viewer to **view all of your global variables in one place!**
59
+
60
+
::read-more{to=#global-variable-viewer}
61
+
Read more about how to use the global variable viewer to **view all of your global variables in one place!**
52
62
::
53
63
54
64
:read-more{to=/api/sub-actions/core/globals}
55
65
56
66
#### User Global Variables
57
-
User variables function as global variables, but store values **per user**.
67
+
User global variables function as global variables, but store values **per user**.
58
68
59
69
::tip
60
-
User variables can be useful for creating per-user counters, leaderboards, or anything you can think of!
70
+
User global variables can be useful for creating per-user counters, leaderboards, or anything you can think of!
61
71
::
62
72
63
73
### Generic
@@ -189,34 +199,34 @@ $parse(line%i%)$
189
199
// ==> returns value of %line1% (the second line of the file)
190
200
```
191
201
::tip
192
-
`%arguments%` and `~persistedVariables~` will be parsed in `parse`'s parameter, but not other `$inline()$` functions. If you wish to use a function, then set another argument to the output of the function, and use that argument in the`parse` instead.
202
+
`%arguments%` and `~persistedGlobalVariables~` will be parsed in `parse`'s parameter, but not other `$inline()$` functions or formatting. If you wish to use another function, set another argument to the output of the function, and use that argument in `parse` instead.
193
203
::
194
204
195
-
## Variable Viewer
196
-
The Variable Viewer in Streamer.bot provides a convenient location to **view, modify, and create** all types of global variables, including per-platform user variables.
205
+
## Global Variable Viewer
206
+
The global variable viewer in Streamer.bot provides a convenient location to **view, modify, and create** all types of global variables, including per-platform user global variables.
197
207
198
-
You can open the variable viewer at any time by clicking `Variables` on the Streamer.bot toolbar:
Copy file name to clipboardExpand all lines: streamerbot/3.api/1.sub-actions/core/globals/global-get.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,17 +2,18 @@
2
2
title: Get Global Variable
3
3
description: Fetch the value of a global variable and populate a local argument
4
4
parameters:
5
-
- name: GlobalVariableSource
6
-
- name: GlobalVariablePersisted
5
+
- name: Source
6
+
- name: Persisted
7
7
- name: Variable Name
8
8
type: Text
9
9
required: true
10
10
description: |
11
-
Enter the name of the variable you would like to fetch
11
+
Enter the name of the global variable you would like to fetch
12
12
13
13
::warning
14
-
`Variable Name` must be entered in `camelCase` (the first letter must be lowercase)
14
+
This is the **name** of the global variable, which means it should not be wrapped in `%` symbols unless you specifically want to use the **value** of a local variable in the **name** of your global variable
15
15
::
16
+
16
17
- name: Destination Variable
17
18
type: Text
18
19
required: true
@@ -22,6 +23,11 @@ parameters:
22
23
::tip
23
24
It is recommended to use a **different name** than the global variable name
24
25
::
26
+
27
+
::warning
28
+
This is the **name** of the destination variable, which means it should not be wrapped in `%` symbols unless you specifically want to use the **value** of a local variable in the **name** of your destination variable
29
+
::
30
+
25
31
- name: Default Value
26
32
type: Text
27
33
description: |
@@ -36,8 +42,8 @@ csharpMethods:
36
42
---
37
43
38
44
::tip
39
-
You can quickly access persisted globals without this sub-action by wrapping the name with `~`<br>
description: Create or update the value of a global variable
4
4
parameters:
5
-
- name: GlobalVariableSource
6
-
- name: GlobalVariablePersisted
5
+
- name: Destination
6
+
- name: Persisted
7
7
- name: Variable Name
8
8
type: Text
9
9
required: true
10
10
description: |
11
-
Enter the name of the variable you would like to create or modify
11
+
Enter the name of the global variable you would like to create or update
12
12
13
13
::warning
14
-
`Variable Name` must be entered in `camelCase` (the first letter must be lowercase)
14
+
`Variable Name` is the **name** of the global variable, which means it should not be wrapped in `%` symbols unless you specifically want to use the **value** of a local variable as the **name** of your global variable
15
15
::
16
-
- name: Source
17
-
type: Select
18
-
default: Argument
19
-
required: true
20
-
description: |
21
-
Select the source for the value to assign to the global variable
22
16
23
-
- `Argument` - Use the value of an argument
24
-
- `Value` - Assign any arbitrary value
25
-
- `Increment` - Add to an existing `int`{lang=cs} variable
26
-
- `Decrement` - Subtract from an existing `int`{lang=cs} variable
27
17
- name: Value
28
18
type: Text
29
19
required: true
30
20
description: |
31
-
Enter the value to assign to the global variable, depends on the selected `Source` type, detailed above
21
+
Enter the value to assign to the global variable, depending on the selected type in the dropdown
32
22
33
-
- `Argument` - Enter the name of an existing argument to assign its value to the global variable
23
+
All options support parsing of %arguments%
34
24
- `Value` - Enter any value
35
-
- `Increment` - Enter any `int`{lang=cs}
36
-
- `Decrement` - Enter any `int`{lang=cs}
25
+
- `Increment` - Enter any `int`{lang=cs} to be added to the existing value
26
+
- `Decrement` - Enter any `int`{lang=cs} to be subtracted from the existing value
27
+
28
+
::tip
29
+
If left empty, `Increment` and `Decrement` default to 1. If the global variable did not already exist, it will add or subtract from 0
Copy file name to clipboardExpand all lines: streamerbot/3.api/1.sub-actions/core/logic/if-else.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,8 @@ parameters:
8
8
description: |
9
9
The value to be tested. Performs full parsing of `%arguments%`{lang=cs}, `~persistedGlobals~`{lang=cs} and `$inlineFunctions()$`{lang=cs}
10
10
::warning
11
-
Unlike earlier version of Streamer.bot, arguments must be enclosed in `%...%` in order for their values to be tested. If using `Does Not Exist`, then just use the argument name, without the `%`.
11
+
Unlike earlier version of Streamer.bot, arguments **must** be enclosed in `%...%` in order for their values to be tested<br/>
12
+
If using `Does Not Exist`, you **must** use *only* the argument name without the `%`.
0 commit comments