Jump to content

GNU/Linux + OSX (or any bash users) - Order checking script


Recommended Posts

There can sometimes be confusion (I've often been on the receiving end of it) when trying to tell if your mod order is "good" or not (pulling info from readmes, trial and error, message forums).

Thankfully the community has https://github.com/ALIENQuake/ProjectInfinity

to alleviate some of these woes - unfortunately, there is no native non-Windows/cross platform solution available, however the data it works off of is just plain old text, which means it *can* be parsed with a small shell script.

For my own usage, and to share with the community, I've created this "bg-order-checker.sh" script (a scripting language would be more robust, but on a very large install, this seems to work so far):

#!/bin/bash
{
target=${target:-weidu.log}
IFS=$'\n'
for f in $(find -maxdepth 2 -name '*.ini' -exec grep -HiE '^Before' {} \;); do
    name=$(echo $f | cut -f2 -d'/' | tr A-Z a-z)
    others=$(echo $f | cut -f2 -d'=' | tr A-Z a-z)
    name_line=$(grep -niE -m1 "^~$name" $target | cut -f1 -d':')

    if [[ -n $name_line ]]; then
      for other in $(echo $others | sed -e 's/[ \n\r]//g' | sed -e 's/,/\n/g'); do
          other_line=$(grep -niE -m1 "^~$other" $target | cut -f1 -d':')
          if [[ -n $other_line ]]; then
            if [[ "$name_line" -gt "$other_line" ]]; then
                echo "$name was installed in the wrong order! (put it before $other)"
            fi
          fi
      done
    else
        echo "$name was not found in our file list of $target"
    fi
done
for f in $(find -maxdepth 2 -name '*.ini' -exec grep -HiE '^After' {} \;); do
    name=$(echo $f | cut -f2 -d'/' | tr A-Z a-z)
    others=$(echo $f | cut -f2 -d'=' | tr A-Z a-z)
    name_line=$(grep -niE -m1 "^~$name" $target | cut -f1 -d':')

    if [[ -n $name_line ]]; then
      for other in $(echo $others | sed -e 's/[ \n\r]//g' | sed -e 's/,/\n/g'); do
          other_line=$(grep -niE -m1 "^~$other" $target | cut -f1 -d':')
          if [[ -n $other_line ]]; then
            if [[ "$name_line" -lt "$other_line" ]]; then
                echo "$name was installed in the wrong order! (put it after $other)"
            fi
          fi
      done
    else
        echo "$name was not found in our file list of $target"
    fi
done
}

This will parse through the same .ini files that ProjectInfinity uses, check their Before/After values, and look into the weidu.log for where you've installed these things.

It relies on using a weidu log, so at this time it can't pre-emptively plan anything (like a recommended install order) - instead it just alerts you if you've clearly botched your setup, so you can try to refine it again the next time around.

Sample feedback (my own here, for the making fun of) will look like this:

❯ bg-order-checker.sh
tactics-remix was installed in the wrong order! (put it before stratagems)
itemupgrade was installed in the wrong order! (put it before stratagems)
iwdification was installed in the wrong order! (put it before stratagems)
transitions was installed in the wrong order! (put it before bg1re)
dc was installed in the wrong order! (put it before npc)
bgqe was installed in the wrong order! (put it before bg1npc)
leui was installed in the wrong order! (put it before stratagems)
thecalling was installed in the wrong order! (put it before stratagems)
bst was installed in the wrong order! (put it before acbre)
bg1re was installed in the wrong order! (put it after transitions)
skipchateauirenicus was installed in the wrong order! (put it after cdtweaks)
c#greythedog was installed in the wrong order! (put it after ajantisbg1)
c#greythedog was installed in the wrong order! (put it after aurenaseph)
c#greythedog was installed in the wrong order! (put it after calin)
c#greythedog was installed in the wrong order! (put it after coran)
c#greythedog was installed in the wrong order! (put it after corthalaromantique)
c#greythedog was installed in the wrong order! (put it after finchnpc)
c#greythedog was installed in the wrong order! (put it after haldamir)
c#greythedog was installed in the wrong order! (put it after keldorn_rom)
c#greythedog was installed in the wrong order! (put it after kelsey)
c#greythedog was installed in the wrong order! (put it after keto)
c#greythedog was installed in the wrong order! (put it after tyrisflare)
c#greythedog was installed in the wrong order! (put it after valerie)
c#greythedog was installed in the wrong order! (put it after xan)
tod was installed in the wrong order! (put it after divine_remix)
acbre was installed in the wrong order! (put it after alternatives)
acbre was installed in the wrong order! (put it after amber)
acbre was installed in the wrong order! (put it after aurenaseph)
acbre was installed in the wrong order! (put it after bst)
acbre was installed in the wrong order! (put it after dsotsc)

 

Edited by ahungry
Link to comment

I have a diff of mods I do have locally, that aren't in your file, and then a few out of order detections for before and after.  I have to write a quick check to get the inverse diff list (ones you've listed that I don't have - I'll make a second post for that).

These are supposed errors on your list @subtledoctor(these mods need to be earlier in order than they are):

❯ target=y.log bg-order-checker.sh  | grep before | sort | uniq
bst was installed in the wrong order! (put it before c#brage)
c#sodtweaks was installed in the wrong order! (put it before sodrtd)
zg_bgnpc_voices was installed in the wrong order! (put it before eet_end)

These are the ones that should come later in the mod order:

❯ target=y.log bg-order-checker.sh  | grep after | sort | uniq
acbre was installed in the wrong order! (put it after alternatives)
c#greythedog was installed in the wrong order! (put it after c#husam)
crossmodbg2 was installed in the wrong order! (put it after c#solaufein)
herthimoney was installed in the wrong order! (put it after imoen4ever)
iwdification was installed in the wrong order! (put it after rr)
skipchateauirenicus was installed in the wrong order! (put it after cdtweaks)
sodrtd was installed in the wrong order! (put it after c#sodtweaks)
tod was installed in the wrong order! (put it after divine_remix)

These are ones that I had, that are missing in your list entirely:

❯ target=y.log bg-order-checker.sh  | grep 'not found' | sort | uniq
a7-magicstore was not found in our file list of y.log
corthalaromantique was not found in our file list of y.log
khalidbg2 was not found in our file list of y.log
luxleysoa was not found in our file list of y.log
rolles was not found in our file list of y.log
tactics-remix was not found in our file list of y.log
underrep was not found in our file list of y.log

For the script to work, I made a file called "y.log" which contained your list, and added a `~` to the start of each (so the script's grep would interpret it as a weidu log entry).

Link to comment

These are the ones I wasn't able to check (232 missing of 400, so I was able to successfully check ~168 mods for order compat):

eefixpack
dlcmerger
hiddengameplayoptions
iwdnpc
turaldnpc
darkhorizonsbgee
roterror
bggoeet
toa
dsotscbgee
drizztsaga
soa
wbgtap
karatur
eternalimoen
bgeear
bgeew
animus
convinientammunition
wmart
bg1npc
bg1npcmusic
extraexpandedenhancedencounters
themed_tweaks
themed_tweaks_v2
k9sharteelnpc
c#brage
white
verrsza
sirene
huple_npc
neera
neerabanters
vynd
drake
rosere
rose
saradas_magic
helarine_bgee
walahnan
jimfix
bg1ub
amber_eet
btl
kittomes
7c#sartweak
a7-banteraccelerator
margarita
highpower
bg_travel
norest
eetgbthfkp
ooze
lucy
reunion
cliffhistory
azenmod
com_encounters
impasylum
planarspheremod
dakkon
swordap
bg2eear
bg2eew
d0questpack
turnabout
hiddenadventure
snakes
dw_lanthorn
xan
yeslicknpc
tiax
ninde_eet
xulaye
aranw
isra_bg2
theundying
dearnise
branwen
viconia
mazzy
yoshimo
7c-yoshi
yoshimoromance
dorn
imoenfriendship
coran
lavalygar
valygarfriendship
haerdalis_friendship
sarevokfriendship
quayle
wings
aura
janquest
derats_ogre
dungeonbegone
teleport
tashia
hephernaanbg2
darron
walahnanbg2
c#brandock
c#grey
c#husam
fadingpromises
longerroad
wheels
edwinromance
sarevokromance
djinnicompanion
wilsonchronicles
imoencandie
imoenisstone
c#solaufein
npcflirt
mih_eq
npckit
extra_kits
kitpack
bearwalker
px_chantelame
duskblade
k9iwdeekit
runescarred
warlock
zkwarlock
warslingsniperkit
seducerkit
bodyguard
jkits
eldritch_magic
cliffkey
unofficial_item_pack
heartwood
hammers
s3disclubs
ofheirloomsandclasses
lavait-iwd
stuffofthemagi
silver_staff_of_aule
mih_ip
mih_sp
k9roughworld
sentrizeal_aa_pack
how_eet
poison_no_bypass
wildmage
ee_content_tweaks
w_packmule
viconiarevamped
3ed
raduzielsuniversalspells
song_and_silence
sword_and_fist
mercenary
refinements
arcanearcher
monasticorders
d5_random_tweaks
polydisp
tomeandblood
a7-golemconstruction
a7-chaossorcerer
palemaster
StormCaller
deitiesoffaerun
ihateundead
a7#improvedshamanicdance
msfm
faiths_and_powers
derats_kits
a7#improvedarcher
charlatan
will_to_power
5E_spellcasting
might_and_guile
FnP_Multiclass
faiths_and_powers_multiclass
Spontaneous_Casting
low_magic
mih_tweaks
s9houserules
polyvorp
metweaks
jtweaks
Imoen4Ever
trap_overhaul
spell_weapons
enchant
scrollcasterlevelmod
animalcompanions
a7noeenpcs
jaheirarecast
chattyimoen
Diablofication
AMMOLESS
butchery
relievewizardslayer
wsr
scales_of_balance
Magic_Battles_Revised
enhanced-powergaming-scripts
tb#tweaks
bgeespawn
bp
bpseries
eetact2
jimfix
difftweak
fullplate
xpmod
thepicturestandard
area_patcher
item_patcher
ee_cosmetic_enhancements
isandir
artaport
d5_lower_dc_req
cd_icpp
bgeeclassicmovies
minornpcportraitsforiwdee
lightingpack
ajantisportraitpack
etamin_soundsets
colorful_specialist_slots
m7multikit
z_hotfixes
dual_to_kit
a7-TextureConvert
generalized_biffing

If i had the .ini file declaring the Before/After for each of these, it'd be easy to rectify and check (the initial script works off the assumption it'd be run in the active game's directory where the unzipped mod dirs still remain, post installation, thus the reliance on matching up to weidu.log).

Edit: Some of these I do have, I just haven't unzipped/installed into the current installation I'm testing this on, and some are from the pre-eet segment.  It'd still be a nice master list to have the remote ini file each of these may have aggregated in one area.

Edited by ahungry
Link to comment
11 hours ago, subtledoctor said:

Interesting. Can you check it against this recommended list? 

I skimmed from the thread where you introduced the tool, and with a bit of diagonal reading, and I did not understand exactly how you cook the list. Can you explain a bit? I've always read from AL|EN that the idea of having a list "would not work because requires a 24/7/365 available maintainer". But maybe that just relates to a more expansive list with conflicts and components. In which ways the list is better or worse than reading the metadata? (aside from not all mods having it, of course :D )

I'm asking, because, while I'm happy installing mods in a console, having a tool to just show a suggested install order which gets the information from the INI files metadata would be something I would appreciate to have and use. I could also go the extra mile and extract the components names/numbers, and generate a file (or files) that could be used to do the "batch" install procedure so one would not have to babysit the installation of a mod interactively.

I have already a cross platform native GUI app done (Moebius Toolkit) that has support for configuring game installations. I can certainly add this, and it would not be too much work, I think. At least for a beta release.

Does anyone else feel that this could be useful to them? Additionally, I can make it both a console tool and a GUI tool. I typically do this already for unit testing the functionality.

Edited by suy
Link to comment
2 hours ago, suy said:

I did not understand exactly how you cook the list. Can you explain a bit?

At the time I could not play EET, so the list was geared toward being two things at once: valid for BGEE, and also valid for BG2EE. It consisted of 1) BGEE-only mods; 2) BG2EE-only mods; and 3) game-agnostic mods (like CDTweaks, SCS, etc.). Each list was organized separately, and then the two were merged in such a way that shared mods maintained their order relative to the game-specific mods. The result was a bit of a jumble.

Now it's got to handle EET as well, which doesn't actually change too much, but adds a few wrinkles because now many BGEE mods might actually coexist with BG2EE mods. The result of this is, you pick and download mods yourself and put them in your game folder, and no matter which or how many mods you have chosen, they will be checked against this list and spit out a custom list with a (mostly, hopefully) valid install order for your selection.

2 hours ago, suy said:

I've always read from AL|EN that the idea of having a list "would not work because requires a 24/7/365 available maintainer".

Yeah. Two posts up ahungry noted that my list is missing about ten mods. And as more mods keep being made (wild, that that is still true in 2022!) they may be left out as well. Putting the list up on Github is meant to help with that - anyone can suggest changes so I don't have to put time into investigating them, and anyone can clone the repo and take it over if I'm not here. But still, it is a static list and will always be prone to being out of date or wrong.

2 hours ago, suy said:

having a tool to just show a suggested install order which gets the information from the INI files metadata would be something I would appreciate to have and use

Indeed. My MacOS tool is written in Applescript (!) but it can run shell scripts so it could integrate ahungry's .ini-checker. That would be wonderful... if I had time to figure out how to do so. OTOH as you can see from his posts, and as I noticed as I was doing a new EET install the other day, most mods don't even have .ini files to read, and of those that do, only about half include install-before and install-after guidance. I don't expect this to change.  So this method is prone to being incomplete.

But... maybe the two methods can work together? The static list could solve the problem of existing mods not having .ini guidance, and if new mods include .ini guidance they could be dynamically integrated with the static list. Maybe if there is a decent starting list, a tool could be made to read any .ini files in the game folder, modify the list and add mods that aren't already on it, and spit out something that looks like a weidu.log. Then that log could be imported into PI, or maybe this putative tool could even call the  Weidu executable and use @Bartimaeus 'fake reinstall' trick to actually install everything...! Boom, you have a bootleg cross-platform mod installer.

Eh, it could work!

Edited by subtledoctor
Link to comment

Thank you. I still don't understand how you do about the hardest part: how do you decide which mods go first? 😛

Another thought that I'm having is that seems that a crowsourced list was proposed by AL|EN (at a time when your list already existed, as it's mentioned). According to what I've read on the thread and a comment from AL|EN in the dynamic install order thread, the list did not receive much traction on the community. However, your list seems strong after this years (even though you seem to be the only one on a `git blame`), so it's nice to see that both approaches seemingly can be used. I will give it a thought, and see if I can make a proof of concept tool.

Link to comment
13 hours ago, suy said:

Thank you. I still don't understand how you do about the hardest part: how do you decide which mods go first?

Well, I started with the install orders some people like AL|EN had created back in the day for the BigWorldSetup tool. Tailored them a bit to account for modern mods and conventions. Some people made comments here and there ("dude why do you have Dace before Keto, you'll totally miss all the crossmod banters!" - as if I had any way of knowing that sort of thing.) And then I mushed them together into a single list because my app can run in a BGEE folder or a BG2EE folder. (Or a BGT foder or an IWDEE folder.) Then I tailored it a bit more when EET can around, and then I looked at some threads around here and made some more adjustments. I did my own installs and made some adjustments based on what I was seeing.

Other people in some of these threads have somewhat different orders. There is no single correct order. You can follow all the rules about particular dependencies and conflicts, and there is still near-infinite variation in the potentially valid install orders. All I try to achieve with this list is an order that more less works. I put some time into tinkering with it because then I don't have to put any time or thought into it when I'm actually installing mods. I run my Weidu Launcher and boom, it presents me all of the mods that are in my game folder, in an order that will probably work. I just double-click, install, double-click, install, over and over, following the list. It's super easy and quick.

Edited by subtledoctor
Link to comment

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...