Skip to content

Fast/easy way to reinstall mods with weidu

jtthjtth Member Posts: 171
I installed all my mods on 2.2 yesterday. Now, 2.3 is out! Yay! Rather than sitting in front of my computer for 45 minutes answering prompts every 5 while SCS reinstalls, is there a way to use the debug files Weidu spits out to do an automated reinstallation?

Comments

  • ErgErg Member Posts: 1,756
    If you know in advance the answers you're going to give and their exact order you can just write them in a text file and then feed the text file to the setup file.

    I will exemplify using one of my mods: the Silver Staff of Aule. The default install would require to enter the following answers:

    0 (to select English)
    i (to install the main component of the mod)
    1 (to select the default icon for the staff)

    This can be automatised by doing this:

    1) write
    0
    i
    1
    in a plain text file, let's say, "ssa.txt".

    2) create a .bat file (that's just a plain text file with extension changed from .txt to .bat; let's say it is called "ssa.bat"), containing the following
    type ssa.txt | setup-Silver_Staff_of_Aule.exe
    3) put both ssa.txt and ssa.bat in the main game folder

    4) double click ssa.bat

    Also be careful that the first mod installed will also ask for the language in which you play the overall game (not just the language for the mod), so there is an additional answer to account for. Using the same mod as example this means something like

    0 (to select English for the mod)
    2 (to select English for the game)
    i (to install the main component of the mod)
    1 (to select the default icon for the staff)
  • smeagolheartsmeagolheart Member Posts: 7,963
    Weidu.log lists the mods and components that you loaded. From that i think you can create a batch file to install :

    Setup-themod.exe --force-install 0 1 2 3
  • jtthjtth Member Posts: 171
    edited June 2016
    Thanks for those answers but that would be just as much work (at least for one go).

    What I was thinking was something more along the lines of this:

    Will the following reinstall the mods I have installed already, using the options I already chose, if I copy over the `weidu.log` file and all the mod folders?

    weidu --reinstall

    That is, does the weidu executable read from weidu.log, or from some other database, to determine what was installed?

    Edit: that doesn't work.
  • jtthjtth Member Posts: 171

    Weidu.log lists the mods and components that you loaded. From that i think you can create a batch file to install :

    Setup-themod.exe --force-install 0 1 2 3

    I'm really hoping this isn't the only way to work this system.
  • ErgErg Member Posts: 1,756
    jtth said:

    but that would be just as much work (at least for one go).

    More work the first time, but it would make further reinstallations almost instantaneous.

    But that's programming in a nutshell: spending hours writing code to automatically do in seconds what would manually take minutes.

    Jokes aside, I'm actually using the method described in my previous post to speed up reinstallation of large mods. For example this is my current installation file for "Level 1 NPCs" on my EasyTutu install:

    0
    N
    Y
    Y
    Y
    I
    N
    N
    N
    N
    I
    I
    I
    I
    6
    0
    3
    101
    101
    112
    112
    I
    4
    0
    0
    4
    4
    4
    4
    6
    6
    6
    6
    107
    91
    I
    3
    0
    2
    107
    97
    I
    9
    0
    0
    1
    1
    1
    1
    5
    5
    5
    5
    104
    104
    90
    90
    I
    19
    0
    0
    107
    15
    11
    I
    1
    0
    2
    107
    I
    5
    0
    2
    104
    99
    I
    11
    0
    1
    107
    102
    I
    5
    0
    3
    103
    94
    I
    4
    0
    0
    4
    4
    4
    4
    6
    6
    6
    6
    105
    91
    I
    16
    0
    0
    107
    107
    95
    112
    I
    2
    0
    1
    92
    92
    114
    114
    I
    2
    0
    1
    89
    89
    114
    114
    I
    12
    0
    1
    113
    104
    104
    99
    111
    I
    2
    0
    1
    93
    93
    111
    111
    0
    0
    I
    9
    0
    4
    1
    1
    1
    1
    5
    5
    5
    5
    107
    107
    96
    96
    I
    14
    0
    8
    107
    101
    I
    4
    0
    3
    7
    7
    7
    7
    7
    7
    7
    7
    95
    113
    I
    2
    0
    1
    114
    114
    114
    90
    I
    4
    0
    2
    3
    3
    3
    3
    3
    3
    3
    3
    94
    103
    I
    15
    0
    4
    2
    2
    2
    2
    2
    2
    2
    2
    107
    97
    I
    3
    0
    1
    107
    97
    I
    19
    0
    0
    107
    15
    11
    I
    1
    0
    7
    107
    I
    8
    0
    6
    107
    97
    97
    112
    I
    3
    0
    0
    100
    107
    I
    3
    0
    3
    97
    107
    I
    7
    0
    0
    90
    90
    105
    105

  • jtthjtth Member Posts: 171
    If I were going to do that I'd just write something to convert Weidu log files into --force-install parameters. Has no one done that? It's just some string parsing.
  • [Deleted User][Deleted User] Posts: 0
    edited June 2016
    The user and all related content has been deleted.
  • ErgErg Member Posts: 1,756
    jtth said:

    If I were going to do that I'd just write something to convert Weidu log files into --force-install parameters. Has no one done that? It's just some string parsing.

    The --force-install method doesn't work for some mods. For example those using ACTION_READLN and similar commands.
  • jtthjtth Member Posts: 171

    jtth said:

    Will the following reinstall the mods I have installed already, using the options I already chose, if I copy over the `weidu.log` file and all the mod folders?

    weidu --reinstall

    That is, does the weidu executable read from weidu.log, or from some other database, to determine what was installed?

    I'm pretty sure Weidu needs to have the /backup folders in the mod folders, and everything in /override, for that to work.

    BUT, it might be worth trying to recreate that. If you have a backup of those things, maybe copy them all to the new game folder and *then* run he reinstall command. Weidu will be able to find all of the files it needs for the reinstall process, and will hopefully rebuild the additions to dialog.tlk from scratch.
    Sadly, this doesn't seem to work.
  • smeagolheartsmeagolheart Member Posts: 7,963
    edited June 2016
    Erg said:

    jtth said:

    If I were going to do that I'd just write something to convert Weidu log files into --force-install parameters. Has no one done that? It's just some string parsing.

    The --force-install method doesn't work for some mods. For example those using ACTION_READLN and similar commands.
    Well there you go. There goes the batch file idea I guess.

    Anyway what I do is I use BWS, which lets you pick components, and export bws selection.ini which I use the next time I want to reload all my mods. Normally at that point I reconsider the list as well when I load my selections.
  • argent77argent77 Member Posts: 3,478
    edited June 2016
    On Windows you have the option to use BWS, as mentioned by @smeagolheart .

    If you can't (or don't want to) use it for installing mods, you can try out the following procedure:
    - Open the current WeiDU.log in a text editor that supports regular expressions (such as Notepad++)
    - Remove the comments from the first three lines and any comment you might find at the end of the file.
    - Open the "Replace" dialog and enable the search mode "Regular expression" (or whatever it's called in your text editor).
    - Enter the following lines into the Find and Replace fields:
    Find what: ^~((.+/)*(.+)\.TP2)~ #([0-9]+) #([0-9]+)( //.*)?$ Replace with: weidu.exe "\1" --language \4 --force-install \5 --log \3-\4-\5.DEBUG
    - Click on "Replace all" (or whatever it's called in your text editor).
    - Save the modifications as a batch file (e.g. install_mods.cmd) in a safe location and quit the text editor.
    - Install the latest game patch.
    - Unpack all mods you want to install in the same way as you've done for the previous game version.
    - Unpack the weidu.exe from the WeiDU package you can find here.
    - Place the "install_mods.cmd" into the game directory.
    - Start a Command Prompt in Administrator mode and navigate to the game directory.
    - Execute "install_mods.cmd"

    Mods that require manual input of data can be installed that way as well, but you have to manually input data when these mods are about to be installed before the script can continue.

    I can't guarantee that it installs everything successfully, but it's worth a try.

    Whether you use this procedure or install all mods manually or via BWS, you have to start a new game in any case.
  • jtthjtth Member Posts: 171
    edited June 2016
    argent77 said:

    On Windows you have the option to use BWS, as mentioned by @smeagolheart .

    If you can't (or don't want to) use it for installing mods, you can try out the following procedure:
    - Open the current WeiDU.log in a text editor that supports regular expressions (such as Notepad++)
    - Remove the comments from the first three lines and any comment you might find at the end of the file.
    - Open the "Replace" dialog and enable the search mode "Regular expression" (or whatever it's called in your text editor).
    - Enter the following lines into the Find and Replace fields:
    Find what: ^~((.+/)*(.+)\.TP2)~ #([0-9]+) #([0-9]+)( //.*)?$ Replace with: weidu.exe "\1" --language \4 --force-install \5 --log \3-\4-\5.DEBUG
    - Click on "Replace all" (or whatever it's called in your text editor).
    - Save the modifications as a batch file (e.g. install_mods.cmd) in a safe location and quit the text editor.
    - Install the latest game patch.
    - Unpack all mods you want to install in the same way as you've done for the previous game version.
    - Unpack the weidu.exe from the WeiDU package you can find here.
    - Place the "install_mods.cmd" into the game directory.
    - Start a Command Prompt in Administrator mode and navigate to the game directory.
    - Execute "install_mods.cmd"

    Mods that require manual input of data can be installed that way as well, but you have to manually input data when these mods are about to be installed before the script can continue.

    I can't guarantee that it installs everything successfully, but it's worth a try.

    Whether you use this procedure or install all mods manually or via BWS, you have to start a new game in any case.

    This is excellent, thank you. Seriously. Doing Lathander's work. Sadly I'm half-way through finishing up the SCS install by hand so I'll keep this in my back pocket for next time.

    Why would I have to start a new game if the previous mod install mirrors my current one? (This is not the case as I'm starting BG2 importing a character from a similarly modded BG1-SOD installation.)
  • The user and all related content has been deleted.
  • The user and all related content has been deleted.
  • jtthjtth Member Posts: 171

    I guess this thread really wanted something like this to exist about three days earlier:

    https://forums.beamdog.com/discussion/59766/mod-dlc-builder-for-enhanced-edition-v2-x-games#latest

    Yeah, but this requires the game versions be the same. I was looking for a solution that was independent of game version. Oh well!
Sign In or Register to comment.