Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This script reads an input txt file, where the steam workshop IDs are defined (one on each line)
- #It then downloads the items and copies to "mods" folder out of each of the steam workshop ID folders.
- #Finally it generates the required mod line in the server ini filde for the Zombiod server. This was done as
- #some mod makers appear to use a different id= line in the mod.info file to the folder name.
- #Zombiod appears to read that line instead of just the folder name, so if you're getting "mod not found" errors this might be the reason.
- #Define paths for various things
- #Path to steamCMD for downloading the workshop items
- $steamCMDdir = "C:\steamcmd\steamcmd.exe"
- #Root folder of the zombiod server files
- $installDir = "C:\Games\zombiodserver\"
- #A txt file with each workshop ID on a separate line
- $modListFile = "C:\Games\zombiodserver\ModList.txt"
- #An output file for the generated mod line used in the server configs(ini file)
- $paramOutFile = "C:\Games\zombiodserver\ParamTest.txt"
- #Where the workshop content folders are located for the zomboid app (108600)
- $installLocationMods = $installDir + "steamapps\workshop\content\108600\"
- #Server directory for mods folder. ie Where to copy the mods folder from each steam workshop item
- $modsFolder = "C:\Users\Administrator\Zomboid\"
- $STEAM_USERNAME = "anonymous"
- $STEAM_PASSWORD = ""
- #Instead of adding the workshop id's in this script, they are done in an external txt file with them on a separte line
- $workshopPublishIdList = Get-Content -Path $modListFile
- #Adding the first part to the arguments list variable. This will login and define the install dir for the workshop mods.
- #$argumentListArray = "+login $STEAM_USERNAME $STEAM_PASSWORD +force_install_dir "+$installDir+" "
- #A loop to add all the workshop download to the arguments list
- foreach($item in $workshopPublishIdList)
- {
- $argumentListArray = "+login $STEAM_USERNAME $STEAM_PASSWORD +force_install_dir $installDir +workshop_download_item 108600 $item validate +quit"
- Start-Process -FilePath $steamCMDdir -ArgumentList $argumentListArray -NoNewWindow -Wait
- echo Start-Process -FilePath $steamCMDdir -ArgumentList $argumentListArray -NoNewWindow -Wait
- }
- #Copy the mods folder out of each of the workshop ids then write out a paramfile with the id text from the mod.info file as the folder names don't always match the id= line. The id= line is what the mods
- foreach($item in $workshopPublishIdList)
- {
- copy-item -Path $installLocationMods$item\mods\ -Destination $modsFolder -force -recurse -Container
- $modInfoFilePath = Get-ChildItem $installLocationMods$item\ -Filter *.info -Recurse | Select-Object -ExpandProperty FullName
- select-string -Path $modInfoFilePath -Pattern '(?<=id=).*' -AllMatches| foreach {$_.Matches.Value + ";"} | out-file -FilePath $paramOutFile -append
- }
Add Comment
Please, Sign In to add comment