Open pastelmind opened 3 years ago
Running ocd-cleanup.ash
can silently change the default value of BaleOCD_DataFile
and BaleOCD_StockFile
.
Necessary conditions:
ocd-cleanup.ash
has never been invoked in the current KoLmafia session.
BaleOCD_DataFile
stored in data/vars_defaults.txt
does not match the current player ID.
vars_defaults.txt
with a text editor and change the value of BaleOCD_DataFile
to foo
.The effect can be directly observed with a ZLib verbosity setting ≥ 4. To change it, enter zlib verbosity = 4
in the gCLI. (Default is 3)
When ocd-cleanup.ash
is invoked for the first time (either directly, or when included by our relay backend), it alters the default value of ZLib variables BaleOCD_DataFile
and BaleOCD_StockFile
:
> ocd-cleanup.ash
New default value for ZLib string setting: BaleOCD_DataFile => <playername>
New default value for ZLib string setting: BaleOCD_StockFile => <playername>
Updating inventory...
ocd-cleanup.ash
sets the default value of BaleOCD_DataFile
to the current player ID.
https://github.com/Loathing-Associates-Scripting-Society/philter/blob/5ee11322cb16f2ecc4a8d93ae92f0f3f1949b534/release/scripts/ocd-cleanup.ash#L10-L11
This is usually not a problem:
BaleOCD_DataFile
, getvar()
will use it, which is what you want.getvar()
will use the default value, which is usually your player ID.setvar()
will update the default value before getvar()
reads it.
ocd-cleanup.ash
for the first time in the current session.Now, what if you had two KoLmafia instances running together?
ocd-cleanup.ash
as player X. This sets the default value of BaleOCD_DataFile
to X
.ocd-cleanup.ash
as player Y. This sets the default value of BaleOCD_DataFile
to Y
.ocd-cleanup.ash
as player X. This does not change the default value of BaleOCD_DataFile
. Instead, the script will attempt to use data/OCDdata_Y.txt
for player X. Which may or may not exist, but is most likely not what you wanted.Both Philter Manager and Philter Manager classic import ocd-cleanup.ash
each time they are invoked. Because of this, you can unknowingly change the default value before you directly run ocd-cleanup.ash
.
Case 1: Original bug report
Excerpt of the original bug report from @Phillammon, over at Discord:
Case 2: Personal anecdote
While attempting to reproduce the report above, I experienced a very similar glitch. Here is what happened:
Note: I have a "main" and "alt" account. Both accounts share a single cleanup ruleset file (
OCDdata_shared.txt
) across all my accounts.I started KoLmafia and logged onto my "main" account. After playing 200-300 turns, I opened Philter Manager (
localhost:60080
) to categorize some items. Then I ranocd-cleanup.ash
to cleanse my inventory.To investigate, I launched a second KoLmafia instance and logged into my "alt" account.
At this point, my ZLib settings files looked like this:
I can attest this because I keep track of my settings using Git, and I commit them every day.
Using the second KoLmafia session ("alt" account), I opened Philter Manager (
localhost:60081
) and changed the ruleset file name fromshared
toalt
. I clicked "Save", then "Copy contents" in the popup. Then I navigated to a different tab (inside Philter Manager) and back to reload the current setting.main
for the ruleset file name, instead ofalt
.At this point, my ZLib settings files looked like this:
Further investigation
127.0.0.1:60080
and127.0.0.1:60081
), both apps send requests to the correct backend. That is, the app from127.0.0.1:60080
sends requests to127.0.0.1:60080
, and127.0.0.1:60081
to127.0.0.1:60081
. Thus, this is not a URL confusion issue.This may be related to #58.