Repository navigation
Butlerv4: per-account options and a Leader option - #41
Merged
Merged
Conversation
Butlerv4 kept every account's leader in one shared Butler1.cfg, so 'skua script start --option Leader1Name=...' for one account rewrote the assignment of every account, and a running Butler kept its old leader. - Options are stored per account (Butler1-<account>), seeded from the shared Butler1 on first use so existing setups carry over. With nobody logged in the shared Butler1 is used as before. - New Leader option: when set it wins over the Leader 1-4 lists, which keep working as before. - A running Butler re-reads its options when their file changes and switches to the new leader. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was wrong
Butlerv4 (
OptionsStorage = "Butler1") keptLeader1Name..Leader4NameandLeader1Butlers..Leader4Butlersin one file,<SkuaDIR>/options/Butler1.cfg, read by every account on the machine. Moving one account to another leader withskua script start --option Leader1Name=... --option Leader1Butlers=...rewrote that file for all accounts, so every switch meant backing it up and restoring it. A Butler that was already running kept its old leader until it was restarted.What changed
OptionsStorageis nowButler1-<account>(lower case) for the logged-in account. The first time an account uses it, it is copied from the sharedButler1.cfg, so existing lists, drops and quests carry over. With nobody logged in (or a name that can't be a file name) it staysButler1.Leaderoption. When set, it wins over the lists:skua script start Tools/Butlerv4/Butlerv4.cs --option Leader=alt1. Since it lives in the account's own file, it never touches another account.Leader1..4lists work as before. WhenLeaderis empty, the first list that names the account picks its leader.Bot.Config.Load()and resolves the leader again. If the leader is different, it drops the TCP link and connects to the new one. If the file no longer names any leader, it logs that and keeps following the current one.Why this design
These are the options I checked in Skua's source:
Leaderoption: ruled out.Option<T>has atransientflag, but the Engine'sscript start --optionrejects transient options ("it resets on every start, so it can't be set",Skua.Engine/Scripts/ScriptOperations.csStore). Transient values also reset on every restart, auto re-logins included, so a Butler would lose its leader after a relogin.Leaderoption in the shared file: ruled out.script start --optionloads the Script's one storage, sets the values and saves the whole file (config.Save()).OptionContainer.Savewrites only the options the Script declares. So any option inButler1.cfgis one value for every account, and per-account keys inside it would be dropped by the next save from another account.OptionsStorageby reflection after it creates the Script (ScriptManager.LoadScriptConfig), so a field initializer can compute it. Both the options window and the Engine's--optionthen read and writeButler1-<account>.cfg. Scripts already keep per-account files this way:CBO_Storage(<user>).txtandUltraLoadoutRestore(<user>).txt.Trade-off: after the first run, a setting changed in one client's options window (lists included) applies to that account only. It no longer reaches every account through the shared file. Seeding from
Butler1.cfghappens only once.Not tested live
--option, theLeaderoverride, and the runtime switch when the file is edited while a Butler runs.skua scripts check Tools/Butlerv4/Butlerv4.cscompiles it with its 3 includes, and thescripts-compile-checkworkflow on noelrohi/Skua passes for this file.🤖 Generated with Claude Code