LadyDefile / Wordsmith-DalamudPlugin

Wordsmith is a Dalamud Plugin aiming to make roleplay easier, more convenient, and harder to accidentally "wrong chat" your post.
7 stars 3 forks source link

Wordsmith crashing or hiding xlplugins #26

Closed Ozymandias-Leviathan closed 1 year ago

Ozymandias-Leviathan commented 1 year ago

Hello.. Just loaded the most recent version of Wordsmith (and I've been sorely missing the Thesaurus for a bit. :) )

Now, whenever I type /scratchpad the screen flickers then all of my dalamud plugins/functionality disappears. /xlplugins or /xllog don't work. I've tried disabling everything BUT wordsmith and it still happens. Unfortunately I'm not seeing anything being written to the dalamug.log either. The only other thing I can see is a warning from wordsmith at startup that the dictionary isn't loaded.

Just now I deleted wordsmith (so no plugins enabled), then with the plugin list still up I looked up wordsmith again, added it. Typed /scratchpad and the plugin list disappeared and no /xl commands are working until I restart the client.

I wish there was something in the dalamug.log to help...maybe there is. Thanks in advance. dalamud.log

Ozymandias-Leviathan commented 1 year ago

image Just deleted the \XIVLauncher\installedPLugins\Wordsmith folder and re-added it. same Dictionary error and same issue. /scrathpad kills the Wordsmith settings window, the plugins list, my chat2 interfact and makes all dalamud commands not work until relog

LadyDefile commented 1 year ago

Ok, well damn. Sorry that this is going on. I'm going to take a quick peek at it right now. I moved to a hosted dictionary file setup to save room on people's drives, allow me to issue updates to the dictionaries without updating the entire program, etc. I'm going to play with it a little bit and see if I can't figure out why it's doing it.

Just to see, can you verify that you are able to load this file in your browser? https://raw.githubusercontent.com/LadyDefile/WordsmithDictionaries/main/library/lang_en

LadyDefile commented 1 year ago

Also, can you try deleting the file located at \XIVLauncher\pluginConfigs\Wordsmith.json?

Ozymandias-Leviathan commented 1 year ago

Thanks for the quick response! Confirmed on the website URL loading without issue.

Deleted wordsmith.json, launched game, and now the issue is gone!

LadyDefile commented 1 year ago

Ok, that solved it? Fantastic. That tells me where to look. It has something to do with the old configuration file. Thank you so much for updating me. I'll keep this ticket open for another day or two in case the problem pops back up.

Reneshi commented 1 year ago

Had the same problem and tried the same solution, and it worked, as long as I had automatic spellcheck turned off. I tried turning it back on and it immediately crashed /xlplugins and the other rp mod I had open (Snooper). Hope that narrows it down a bit for you!

LadyDefile commented 1 year ago

Ok, so turning automatic spellcheck on caused it to break. Interesting. I'll look into that. In the Wordsmith.json file, there is a property "DictionaryFile". Does it say "web: lang_en" or just "lang_en"? It should say "web: lang_en". if it doesn't, try changing that and let me know if that fixes the issue there. I discovered that I didn't update the configuration creation script so it doesn't use the correct name.

Reneshi commented 1 year ago

I restarted, removed the Wordsmith.json file and reinstalled it before I saw your reply. The reinstalled one says "web: lang_en" and appears to now be working correctly. A very odd glitch, if it repeats I'll let you know!

LadyDefile commented 1 year ago

I have a REAL update to the problem. After hours of scouring my code and ripping it apart as much as possible, I found one tiny, itty-bitty mistake that came together under a "perfect storm". Essentially, this:

        // If spell check is disabled, make the button dark so it appears as though it is disabled.
        if (!Lang.Enabled)
            ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f);

        if ( !Wordsmith.Configuration.AutoSpellCheck )
        {
            // Draw the spell check button.
            ImGui.TableNextColumn();
            if ( this.ScratchString.Length == 0 )
                ImGui.BeginDisabled();

            if ( ImGui.Button( $"Spell Check##Scratch{this.ID}", ImGuiHelpers.ScaledVector2( -1, 25 ) ) )
                if ( Lang.Enabled ) // If the dictionary is functional then do the spell check.
                    DoSpellCheck();

            if ( this.ScratchString.Length == 0 )
                ImGui.EndDisabled();

            // If spell check is disabled, pop the stylevar to return to normal.
            if ( !Lang.Enabled )
                ImGui.PopStyleVar();
        } 

The first if (!Lang.Enabled) was outside of the if (!Wordsmith.ConfigurationAutoSpellCheck) which was fine unless the dictionary failed to load. When the dictionary failed to load, Lang.Enabled would be false. If it was false, it would push "half visibility" to the style. Then, if AutoSpellCheck was enabled, it would never Pop the style off, which meant it would make it half visible every frame which very, very quickly made it disappear.

I have already fixed this and should have the update pushed within the next hour or two and then it will be live as soon as the Dalamud team review it.