Mod Incompatability

Discuss modding questions and implementation details.
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Mod Incompatability

Post by Ralzar »

We have code for mod dependencies, which I use in a few of my mods. But now I suddenly ran into a different problem that will probably be bigger in the future: Flagging mods as incompatible.

In my case it is just between my mods. I am merging "Filling Food" into "Climates & Cloaks". This means that players could easily wind up with my new C&C while also having the old FF.

Now, I can do some code in my new C&C that turns off all FF effects if you have the old FF and then gives you a popup at game start telling you this.
But it would be really handy if the mod-list gave a popup about this and asked if you wanted to deactivate FF. It already does something very similar for dependencies where it asks you if you want it to re-arrange the mod load order. This would be the same, except deactivating mods that are incompatible with the mod doing the asking.


Edit: I guess I could improvise something with the version requirements?

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Mod Incompatability

Post by TheLacus »

This is a valid concern, i'll think of something. In the meanhwile, a workaround with the existing tools is to require a version higher than available. The error prompt should suggest people to investigate on forum.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: Mod Incompatability

Post by Ralzar »

Requiring a higher version number worked, sort of. It is easy in this case, since Filling Food is my mod and I don't intend to ever release a new version.

However, it doesn't work quite as one would expect:
CCFF.png
CCFF.png (96.44 KiB) Viewed 1365 times

Clicking YES does nothing. What I think it should do, is deactivate mods that are incompatible with C&C or simply have no YES/NO prompt and do nothing more than warn the user of the problem.

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Mod Incompatability

Post by TheLacus »

This happens because multiple issues of different kinds can be encountered but only the message for the first one is shown (always with the yes-no buttons). Showing all messages can potentially results in too much text content to be handled.

A possible improvement, which doesn't require creating new UI controls, is the following:
  • Shows the first error message with a "next" button.
  • Change text content to the second message and so on.
  • If at least one issue can be fixed by sorting, shows a last message to prompt auto-sort.
The alternative would be to show all messages and the yes-no buttons at the same time (if needed); for example scrollbar support could be added to the message box window. Interkarma do you have an opinion on this?

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Mod Incompatability

Post by Interkarma »

I don't mind extending message boxes to support scrolling. A lot of the framework for this is already scattered around other UI classes (books are kind of similar). Would you like me to roll this in when I can?

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Mod Incompatability

Post by TheLacus »

If it doesn't take too much of your time, yes thank you. I would appreciate the ability to show a list of all error messages without worrying about text length. But it's not a vital or urgent feature. 😉

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Mod Incompatability

Post by Interkarma »

TheLacus wrote: Fri May 01, 2020 9:15 pm If it doesn't take too much of your time, yes thank you. I would appreciate the ability to show a list of all error messages without worrying about text length. But it's not a vital or urgent feature. 😉
I've implemented support for scrolling DaggerfallMessageBox now. It's just a simple extension and supports vertical scrolling only, but should do the trick for this.

https://github.com/Interkarma/daggerfal ... 12a9f85b72

Here's an an example you should be able to plop in almost anywhere. Just need to call EnableVerticalScrolling() before feeding it all the text. Let me know if any troubles with it.

Code: Select all

// Generate oversized multiline text for scrolling popup window - add your own text here
List<TextFile.Token> allTokens = new List<TextFile.Token>();
for (int id = 0; id < 8; id++)
{
    TextFile.Token[] tokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(id);
    allTokens.AddRange(tokens);
}

// Create scrolling message box - needs to be done in below order specifically for everything to resize and position correctly
DaggerfallMessageBox mb = new DaggerfallMessageBox(uiManager, this);
mb.EnableVerticalScrolling(120);
mb.SetTextTokens(allTokens.ToArray());
mb.AddButton(DaggerfallMessageBox.MessageBoxButtons.OK);
//mb.OnButtonClick +=
mb.Show();

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Mod Incompatability

Post by TheLacus »

Thanks mate :)

I actually have a minor issue: the value passed to EnableVerticalScrolling() need to be chosen depending on actual length of text to be shown. I believe that if the height set for scrollbar is bigger than what would be needed to show the entire text, it doesn't show anything at all.

Code: Select all

var lines = new []
{
    "line 1",
    "line 2",
    "line 3",
    "line 4",
    "",
};

DaggerfallMessageBox mb = new DaggerfallMessageBox(uiManager, this);
mb.EnableVerticalScrolling(10);
mb.SetText(lines);
mb.Show();
messageBox_1.png
messageBox_1.png (35.48 KiB) Viewed 1242 times

Code: Select all

mb.EnableVerticalScrolling(50);
messageBox_2.png
messageBox_2.png (39.94 KiB) Viewed 1242 times
Optimally it would simply show an empty space after text, or maybe it could be resized appropriately (and consider the requested height as a max value). For the moment i think i can set it depending on the number of lines (lines * k).

Ps: I need to explicitly add an additional empty line or the bottom part of text is cut (SetText(string[] rows, IMacroContextProvider mcp = null) doesn't add a NewLine after the last line).

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Mod Incompatability

Post by Interkarma »

Edit: I see what you're saying. I'll take a closer look when I can.

Edit2: Have fixed those issues. I'll test some more and post fix soon.

User avatar
Interkarma
Posts: 7236
Joined: Sun Mar 22, 2015 1:51 am

Re: Mod Incompatability

Post by Interkarma »

I've pushed some fixes now. The following should work OK without extra line space and at any reasonable height.

Sorry for being slow understanding the problem, I haven't been awake long. :?

Code: Select all

var lines = new[]
{
    "line 1",
    "line 2",
    "line 3",
    "line 4",
};

DaggerfallMessageBox mb = new DaggerfallMessageBox(uiManager, this);
mb.EnableVerticalScrolling(10); // 10 or 50 should both work now
mb.SetText(lines);
mb.Show();

Post Reply