E-M-R

Zombiod Steam Workshop Downloader

Oct 11th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #This script reads an input txt file, where the steam workshop IDs are defined (one on each line)
  2. #It then downloads the items and copies to "mods" folder out of each of the steam workshop ID folders.
  3. #Finally it generates the required mod line in the server ini filde for the Zombiod server. This was done as
  4. #some mod makers appear to use a different id= line in the mod.info file to the folder name.
  5. #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.
  6.  
  7.  
  8. #Define paths for various things
  9.  
  10. #Path to steamCMD for downloading the workshop items
  11. $steamCMDdir = "C:\steamcmd\steamcmd.exe"
  12. #Root folder of the zombiod server files
  13. $installDir = "C:\Games\zombiodserver\"
  14. #A txt file with each workshop ID on a separate line
  15. $modListFile = "C:\Games\zombiodserver\ModList.txt"
  16. #An output file for the generated mod line used in the server configs(ini file)
  17. $paramOutFile = "C:\Games\zombiodserver\ParamTest.txt"
  18. #Where the workshop content folders are located for the zomboid app (108600)
  19. $installLocationMods = $installDir + "steamapps\workshop\content\108600\"
  20. #Server directory for mods folder. ie Where to copy the mods folder from each steam workshop item
  21. $modsFolder = "C:\Users\Administrator\Zomboid\"
  22. $STEAM_USERNAME = "anonymous"
  23. $STEAM_PASSWORD = ""
  24.  
  25. #Instead of adding the workshop id's in this script, they are done in an external txt file with them on a separte line
  26. $workshopPublishIdList = Get-Content -Path $modListFile
  27.  
  28. #Adding the first part to the arguments list variable. This will login and define the install dir for the workshop mods.
  29. #$argumentListArray = "+login $STEAM_USERNAME $STEAM_PASSWORD +force_install_dir "+$installDir+" "
  30.  
  31. #A loop to add all the workshop download to the arguments list
  32. foreach($item in $workshopPublishIdList)
  33. {
  34.    $argumentListArray = "+login $STEAM_USERNAME $STEAM_PASSWORD +force_install_dir $installDir +workshop_download_item 108600 $item validate +quit"
  35.     Start-Process -FilePath $steamCMDdir -ArgumentList $argumentListArray -NoNewWindow -Wait
  36.     echo Start-Process -FilePath $steamCMDdir -ArgumentList $argumentListArray -NoNewWindow -Wait
  37.  
  38. }  
  39.  
  40. #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
  41. foreach($item in $workshopPublishIdList)
  42. {
  43.    copy-item -Path $installLocationMods$item\mods\ -Destination $modsFolder -force -recurse -Container
  44.    $modInfoFilePath = Get-ChildItem $installLocationMods$item\ -Filter *.info -Recurse | Select-Object -ExpandProperty FullName
  45.    select-string -Path $modInfoFilePath -Pattern '(?<=id=).*' -AllMatches| foreach {$_.Matches.Value + ";"} | out-file -FilePath $paramOutFile -append
  46.  
  47. }
Add Comment
Please, Sign In to add comment