Jump to content

BAIN wizard - how to conditionally pre-select options in a SelectMany list?

Recommended Posts

I'm new to BAIN so I'm probably overlooking something obvious...


I have a SelectMany list with names of various mods. I want the list to auto-select the mods it detects are present and active. I know how to check the presence and status.


And I'm not talking about selecting subpackages, I know how that works. This particular SelectMany is for setting variables, not subpackages.


I know that adding a pipe character at the start of an option string will make it selected by default; do I need to conditionally add the pipe character? Seems a bit unintuitive.

Share this post

Link to post
Share on other sites

I have never made a BAIN wizard like that but I understand what you are trying to achieve ( I'm also a bit rusty right now on this stuff ), and believe there are probably a few ways to skin that cat ..


I would suggest having a good look through Metallicows Demo wizard ( always linked in the first post of the latest Wrye Bash topic )

( And if you didnt know, at the end of the second post in that topic is the latest bleeding edge version of WB ( I am currently using the Bleeding edge 307 Installer, to install standalone version 307.201610020028 ) )


Whether for Oblivion or for Skyrim, BAIN wizards all work with the same command set, so this documentation is universal ( its the Technical Readme )



Edit : Also may be worth a look is Surazals old Sensual walks BAIN for Oblivion, its wizard is very efficient and from what I remember uses DataFileExists plus variables for a wizard which requires no input or selections from the user

Share this post

Link to post
Share on other sites

I'd be interested if you found a better way, but the janky way I ended up doing this in my wizard was to create multiple SelectMany lists and bracketing the entire thing by a if getespmstatus or if var resulting from a previous getespmstatus check.

Share this post

Link to post
Share on other sites

My solution wasn't very elegant or compact, but it was the only way I could come up with for the moment...
I first did an if statement for each mod which defined the strings for the SelectMany block, and added the pipe character to the string if the mod was either active or part of the merged patch:

sModName320 = "Open Cities Skyrim"
sModDescription320 = "Select this option if you are using Arthmoor's 'Open Cities Skyrim' mod."
If GetEspmStatus("Open Cities Skyrim.esp") > 1
    sModName320 = "|" + sModName320

...followed by the SelectMany. Annoyingly there doesn't seem to be a way to sort the options in the Select statements so I had to do it manually:

SelectMany "Compatibility Patches",\
  Case "Dawn of Skyrim (Director's Cut)"
    SelectSubPackage "119 - Dawn of Skyrim - " + sMass
    SelectEspm "Blowing in the Wind - Dawn of Skyrim (Director's Cut) Patch.esp"

...followed by a few checks for situations where certain combinations of mods needs additional patches:

; Compatibility Add-ons for Compatibility Add-ons
If bMysticalIllumination
  If bSignsOfSkyrim
    SelectSubPackage "201 - Mystical Illumination - Signs of Skyrim - " + sMass
  If bTheBloodyTankard
    SelectSubPackage "202 - Mystical Illumination - The Bloody Tankard - " + sMass

Certainly won't win any beauty competitions, but at least it will be userfriendly.


Really wish it supported arrays and more convenient ways to select checkboxes.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Support us on Patreon!