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
{{ message }}
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
# Streamlabs-Rcon-Integration
2
2
3
3
4
-
A Python exe for integrating Streamlabs and any game supporting Rcon. It receives the Streamlabs events and uses configurable logic to send an approperiate RCON command to the game server to do something. Its currently being used with Factorio, but should be compatible with any other Rcon interfaced game.
4
+
A Python exe for integrating Streamlabs and any game supporting Rcon. It receives the Streamlabs events and uses configurable logic to send an appropriate RCON command to the game server to do something. Its currently being used with Factorio, but should be compatible with any other Rcon interfaced game.
5
5
6
6
At present only really tested with Twitch, but should work with mixer and youtube based on API spec. The tool runs fully on your pc removing any risk of sharing access keys or donators details.
7
7
@@ -11,8 +11,8 @@ Installation & Usage
11
11
==========
12
12
1. Install the current release of Python 3.7 with default options: https://www.python.org/downloads
13
13
2. Get the exe from the [latest version zip](https://github.com/muppet9010/Streamlabs-Rcon-Integration).
14
-
3. Create a free account at [Currency Layer website](https://currencylayer.com) and make a note of the API access key as needs to be entered in to the programs config later on.
15
-
4. Unzip the files in to the desired folder.
14
+
3. Create a free account at [Currency Layer website](https://currencylayer.com) and make a note of the API access key as needs to be entered into the program's config later on.
15
+
4. Unzip the files into the desired folder.
16
16
5. Open config.json in a text editor and add in your details.
17
17
6. Run the program: Streamlabs Rcon Integration.exe
18
18
7. Select the desired profile from the dropdown and click Start.
@@ -27,23 +27,23 @@ Note: on clicking `Start` the program checks the RCON connection. If a Factorio
27
27
Program Execution Concepts
28
28
========
29
29
30
-
The app takes in Streamlabs events and processes them through configurable reactions to trigger a desired action via Rcon in game. These reactions are grouped togeather as savable profiles.
30
+
The app takes in Streamlabs events and processes them through configurable reactions to trigger the desired action via Rcon in game. These reactions are grouped together as savable profiles.
31
31
32
-
The complete list of Streamlabs events and their contained data attributes can be found in the [eventDefinitions.json file](https://github.com/muppet9010/Streamlabs-Rcon-Integration/eventDefinitions.json). The top section under `[ALL]` are generated and normalised by the program to provide some standard entries across all event types. The list of platform and event specific attributes are what streamlabs is currently sending. These often vary from their documentation and change periodically.
32
+
The complete list of Streamlabs events and their contained data attributes can be found in the [eventDefinitions.json file](https://github.com/muppet9010/Streamlabs-Rcon-Integration/eventDefinitions.json). The top section under `[ALL]` are generated and normalised by the program to provide some standard entries across all event types. The list of platform and event specific attributes are what Streamlabs is currently sending. These often vary from their documentation and change periodically.
33
33
34
-
The app runs a single grouping of reactions at a time, being loaded and saved as a profile. During the process if no suitable option is found it will be shown within the app and that events processing stops. Its assumed you want to handle any event you get. Special options at each level exist for more simple uses cases.
34
+
The app runs a single grouping of reactions at a time, being loaded and saved as a profile. During the process if no suitable option is found it will be shown within the app and that events processing stops. It's assumed you want to handle any event you get. Special options at each level exist for more simple uses cases.
35
35
36
-
When an Streamlabs event is received it is processed to have the standard `[ALL]` additional data attributes calculated for them. The reactions are reviewed to find the most approperiate one. First the reactions are checked for the first matching platform and type to the event. If no match is found the ValueType of the event is checked for in the reactions for a match.
36
+
When a Streamlabs event is received it is processed to have the standard `[ALL]` additional data attributes calculated for them. The reactions are reviewed to find the most appropriate one. First, the reactions are checked for the first matching platform and type to the event. If no match is found the ValueType of the event is checked for in the reactions for a match.
37
37
38
-
Assuming a reaction for the event is found the reaction's filter script is checked for the first that is met (resolves to True). Filters allow a scripts conditions to be used to select the approperiate action to do for the event. All of the events data attributes from Streamlabs and this app can be used witihn the filter in the format `[DATA_ITEM_NAME]`. i.e. `[VALUE] >= 5 and [VALUE] < 10`. There is a special `ALL` filter option that it configured will be triggered after all other filters have been checked. The filters within a reaction are not order specific and so should not overlap each others conditions.
38
+
Assuming a reaction for the event is found the reaction's filter script is checked for the first that is met (resolves to True). Filters allow the conditions of a script to be used to select the appropriate action to do for the event. All of the events data attributes from Streamlabs and this app can be used within the filter in the format `[DATA_ITEM_NAME]`. i.e. `[VALUE] >= 5 and [VALUE] < 10`. There is a special `ALL` filter option that if configured will be triggered after all other filters have been checked. The filters within a reaction are not order specific and so should not overlap each other's conditions.
39
39
40
-
The first complying reaction filter will then run an optional manipulator script if configured. This creates a new data item for the event `[CALCVALUE]` with the scripts output value. This is used when you want to pass a modified value in to the game. Note that the values are treated as doubles and so rounding of the output to desired accuracy is advised.
40
+
The first complying reaction filter will then run an optional manipulator script if configured. This creates a new data item for the event `[CALCVALUE]` with the scripts output value. This is used when you want to pass a modified value into the game. Note that the values are treated as doubles and so rounding of the output to the desired accuracy is advised.
41
41
42
-
The action tied to the filter are the Rcon commands that are run in the game. It can utilise any of the events data attributes in the standard format `[DATA_ITEM_NAME]`. i.e. `[name] supported with $[VALUE] worth $[CALCVALUE]` or `/promote [name]`. There is a special `NOTHING` action that is intended for intentionally ignoring the event. This avoids any warnings about unhandled events. Actions can be either a specific Lua command string or the name of a shared Lua command string within the profile. This is to allow re-use of Lua command strings when its convienent. Should an Rcon command get a response from the server it will be shown in the Activity Log as is liekly an error from the game.
42
+
The action tied to the filter is the Rcon commands that are run in the game. It can utilise any of the events data attributes in the standard format `[DATA_ITEM_NAME]`. i.e. `[name] supported with $[VALUE] worth $[CALCVALUE]` or `/promote [name]`. There is a special `NOTHING` action that is intended for intentionally ignoring the event. This avoids any warnings about unhandled events. Actions can be either a specific Lua command string or the name of a shared Lua command string within the profile. This is to allow re-use of Lua command strings when it's convenient. Should a Rcon command get a response from the server it will be shown in the Activity Log as is likely an error from the game.
43
43
44
44
All data attributes used in scripts are replaced with their event data values at execution time. The replaced text may require wrapping in quotes if it needs to be treated as a string. A script is a single python expression that can be processed via the Python eval() function. It is executed within an environment that includes the Python maths module.
45
45
46
-
When the application starts up all profiles in the profile folder are checked for their compliance with the event handler types and their attributes. All conditions and manipulators will be tested with a value of "1" for all attributes to confirm they are valid python scripts. Any issues causes the program to stop loading and the issue is recorded to the log file. This is to avoid failure from mis-configuration at run time.
46
+
When the application starts up all profiles in the profile folder are checked for their compliance with the event handler types and their attributes. All conditions and manipulators will be tested with a value of "1" for all attributes to confirm they are valid python scripts. Any issues cause the program to stop loading and the issue is recorded to the log file. This is to avoid failure from misconfiguration at run time.
47
47
Additional profiles can be created within the Profiles folder following the sample profile syntax and the eventDefinitions.json events and attributes.
48
48
49
49
After configuring the application it is advised to run it and use the Streamlabs Test Widget option to send test events and confirm it behaves as you expect.
@@ -53,20 +53,20 @@ After configuring the application it is advised to run it and use the Streamlabs
53
53
Testing Notes
54
54
=============
55
55
56
-
There is a crude event testing option at the bottom of the app. It will fake Streamlabs events to the program, allowing testing of reactions. It is often useful to enable the `Rcon No Commands` config option to allow testing by pritning the rcon commands rather than running them.
56
+
There is a crude event testing option at the bottom of the app. It will fake Streamlabs events to the program, allowing testing of reactions. It is often useful to enable the `Rcon No Commands` config option to allow testing by printing the Rcon commands rather than running them.
57
57
58
58
Each platform and event type will dictate if the input fields are enabled/utilised or not. These fields control specific attributes of the faked events.
59
59
60
-
- Event Value - The raw value passed in to the event. This can be a whole number (int) or decimal (float) and used by most events. For donations and pledges it will be the USD value, the number of bits or the type of subscription (1000, 2000, 3000).
60
+
- Event Value - The raw value passed into the event. This can be a whole number (int) or decimal (float) and used by most events. For donations and pledges it will be the USD value, the number of bits or the type of subscription (1000, 2000, 3000).
61
61
- Quantity - The quantity of the event. This must be a whole positive number when used. For Mystery Gift Subscriptions this is how many subscriptions are being gifted.
62
-
- Payload Count - The number of viewers events contained within this Streamlabs API call. This is to simulate Streamlabs habit of bundlign multiple events of the same type togeather if they happen at the same time. i.e. if 2 viewers both follow at once you will get 1 Streamlabs API call with 2 payloads (events) within it. This is invisble from the reactions as each event is handled seperately, but included for developer testing, so leave as default value of `1`.
62
+
- Payload Count - The number of viewers events contained within this Streamlabs API call. This is to simulate Streamlabs habit of bundling multiple events of the same type together if they happen at the same time. i.e. if 2 viewers both follow at once you will get 1 Streamlabs API call with 2 payloads (events) within it. This is invisible from the reactions as each event is handled separately, but included for developer testing, so leave as the default value of `1`.
63
63
64
64
65
65
66
-
Profram Config Notes
66
+
Program Config Notes
67
67
============
68
68
69
-
The program has a `config.json` that stores its global configruation. The settigns in here that require additional details are:
69
+
The program has a `config.json` that stores its global configuration. The settings in here that require additional details are:
70
70
71
71
-`Rcon No Commands` - When enabled it prints the RCON commands to the activity window rather than sending them. It also skips the RCON connection test which the Start button is clicked within the app. In effect not doing any RCON commands.
72
72
@@ -75,12 +75,12 @@ The program has a `config.json` that stores its global configruation. The settig
75
75
Creating Profiles Notes
76
76
========
77
77
78
-
Profile configuration files must be created with knowledge of quote escaping. The profile file is in the JSON syntax and so all text strings must be wrapped in double quotes `"` within it. If you want to use a duoble quote within a text string it must be escaped with a back slash `\`. Single quotes can be used fine within a JSON string and are advised for this reason. Data attributes will be made safe by the program; with any single or doube quotes either being removed by Python automatically or escaped with a backslash before being used as part of an rcon command. If you require a single or double quote to be recieved by Rcon escaped then you must escape it with 2 back slashes`\\'`. See the `Factorio - Advanced Usage Example.json` for examples of the some of these combinations.
78
+
Profile configuration files must be created with knowledge of quote escaping. The profile file is in the JSON syntax and so all text strings must be wrapped in double quotes `"` within it. If you want to use a double quote within a text string it must be escaped with a backslash `\`. Single quotes can be used fine within a JSON string and are advised for this reason. Data attributes will be made safe by the program; with any single or double quotes either being removed by Python automatically or escaped with a backslash before being used as part of a Rcon command. If you require a single or double quote to be received by Rcon escaped then you must escape it with 2 backslashes`\\'`. See the `Factorio - Advanced Usage Example.json` for examples of the some of these combinations.
79
79
80
-
Manipulator script's are special in that they support raw python code that will be executed within a Python exec() function in addition to a python expression that is executed within a Python eval() function. The event handler will try to eval() the manipulator script first and should it error then try to exec() the manipulator script. As the manipulator script is supplied via the profile JSON file it must be in a single line format with `\n` for the line breaks. The Python maths module is included within the execution environment. The local variable `calcValue` is passed out of the exec environment as the value of `CALCVALUE`. See the `Factorio - Advanced Usage Example.json` for examples of the some of these combinations. Note that the values are treated as doubles when being manipualted and so rounding of the output to desired accuracy is advised.
80
+
Manipulator scripts are special in that they support raw python code that will be executed within a Python exec() function in addition to a python expression that is executed within a Python eval() function. The event handler will try to eval() the manipulator script first and should it error then try to exec() the manipulator script. As the manipulator script is supplied via the profile JSON file it must be in a single line format with `\n` for the line breaks. The Python maths module is included in the execution environment. The local variable `calcValue` is passed out of the exec environment as the value of `CALCVALUE`. See the `Factorio - Advanced Usage Example.json` for examples of the some of these combinations. Note that the values are treated as doubles when being manipulated and so rounding of the output to the desired accuracy is advised.
81
81
82
-
Profiles can have `options` specified for them to control specific program behavior:
83
-
- twitchMysterSubGiftMode = when Twitch Subscription Mystery Gifts are given out by a viewer to random other viewers the event can either be reacted to for the donator or receiver. The programs default is the `donator` value if the setting isn't specified in the profile's options. The `money`valyeType will obey this setting and the other event type won't be triggered for Twitch Subscription Mystery Gifts to avoid duplicate reactions.
82
+
Profiles can have `options` specified for them to control specific program behaviour:
83
+
- twitchMysterSubGiftMode = when Twitch Subscription Mystery Gifts are given out by a viewer to random other viewers the event can either be reacted to for the donator or receiver. The program's default is the `donator` value if the setting isn't specified in the profile's options. The `money`valueType will obey this setting and the other event type won't be triggered for Twitch Subscription Mystery Gifts to avoid duplicate reactions.
84
84
-`donator` - react to it as one large donation using the `subMysteryGift` event reaction.
85
85
-`receiver` - react to each viewer getting the gifted subscription using the `subscriptionGift` event reaction.
0 commit comments