Plugin Submission -- Change Swap Timers Live #52
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A simple plugin that uses an external text file to allow players to change the swap timers on the fly. Use cases include donation incentives -- every $X dollars makes games swap Y seconds faster until end of stream, etc.
It doesn't access the configuration or other files directly, but the way that the changes are made to end up effecting the config.lua file in the end; the numbers entered for this plugin end up being the default settings when starting up a new session of the Shuffler. It loads the plugin's configuration file, executes the lines inside (config.min/max_swap = X), then unloads the file both at the start of a new/resumed Shuffler session and right before every game swap.
This might not be the right way to handle it in a plugin, especially if it's meant to be shared to others. It might make a better feature request, so that someone with more experience can add it in a way that couldn't eventually break things -- by allowing the user to add any kinds of code they want to the plugin config, for example. I did try to figure out how to open the file and just look for the numeric values, then assign, say, config.swap_min = <config.txt line 1>, but ran into local / function variable errors. Most of my coding experience is in PHP; I imagine it's easy enough to do, but I wasn't able to figure out how to do it correctly with that approach.
I'm new to GitHub, so I made a fork to upload the plugin to to make the request. But I never like how GitHub doesn't make it obvious, especially if you're new or just looking for the daggone download link, whether you're looking at a fork or the original. So I modified the readme file so it would change the text on the front of my fork -- and now it's submitted that file as well. I'll try to take it out of the request, but I'll be honest, GitHub just confuses me most of the time so if I can't figure it out just know that, obviously, that wasn't part of the request.