Jump to content

DayZ Steam Workshop Scripts


fjamieson

Recommended Posts

These scripts are based off of the example scripts on the TCAdmin Wiki page (https://help.tcadmin.com/Workshop_Browser) for Arma 3.

 

With a little help from Luis (Thanks a bunch), I have made the following scripts for DayZ.

 

DayZ_WS_Install.txt - for the post install operations

DayZ_WS_Uninstall.txt for the post uninstall operations.

 

I have added comments to explain some of my logic... Also added some additional checking which, honestly should not be needed, but users will be users and can get 'delete' happy when things don't work!!

 

There is still one thing I need to finish (may be someone where can help): :-)

On the Uninstall script: currently I do not delete the .bikey file because there is a chance the user has installed several mods written by the same developer and they all use the same .bikey file name. So, I need to figure out a way to parse the @<mod folder>/keys folders after the Uninstall' and verify that all the .bikey files for the remaining mods are in place (copy missing file if necessary).

 

If there are any suggestion to improve the efficiency of the code, please let me know.. I am finally getting back into 'programming' after a 20 year absence from it.

 

Hope you find them useful

 

 

PS: Also have Ark and Conan Exiles scripts. The Ark script is only a GameUserSttings.ini file update. Will post if anyone is interested.

DayZ_WS_Install.txt

DayZ_WS_Uninstall.txt

Link to comment
Share on other sites

  • 4 months later...

Hi Fjamieson

 

thanks for these scripts but I cant get them to work, they download, but they dont move the files or create anything in the commandline, I suspect it has something to do with the Variables

 

# Setup variables

servertag="Server"

mods=""

 

So, I create them but not sure exactly what is needed, do I create a variable called mods with default value "" and do I tick anything under advance? Like Script paramater ?

 

Same with commandline do just put a -mod in command line or should I be adding -mod=![something]

 

Thanks for the script otherwise

Link to comment
Share on other sites

I have updated the scripts. Will post updated ones soon

Have separate scripts to handle mods tagged as 'mod' and 'server' , so that they update to the appropriate commandline options. problem being some mod authors/dev tag their mods incorrectly in the Steam Workshop. Mods that go client and server should be tagged as "Mod" and server ONLY as 'Server, but they are tagging the client/server mods as 'Mod,Server' which complicates things.

 

Also, have a separate script that sets the variables on Install/Reinstall. They are not initialized by default.. learned this the hard way.

 

Will also update the 'in-script' comments/documentation.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks I even ended up using them for Arma, they are great, just one question is there anyway it could be modified that it adds any new mod it installs to the BACK of the commandline list? Right now if you install a mod it adds the new @MOD to the front of the line, so each and everytime a mod is added you need to edit the commandline manually cause iwth DAYZ most mods require a mod called CF and online community and it has to be first, so yes after you install a new mod, you need to move them again to the front.

Link to comment
Share on other sites

Rislem,

 

The change should be:

if (mods.find(';') != -1) :
   ThisService.Variables["Mods"]=mods + ":" + String.Format("@{0}", ModName)
else :  
  if len(mods) > 0 :
     ThisService.Variables["Mods"]=mods + ";" + String.Format("@{0}", ModName)
  else :
     ThisService.Variables["Mods"]=mods + String.Format("@{0}", ModName)

 

The reason I added them to the start is to ensure people read the documentation and  check their commandline after installation and do not blindly add mods and then wonder why they have issues.

I know it is a pain....

 

 

Link to comment
Share on other sites

New scripts:

DayZ_CS_......txt files are install/ininstall scripts for mods that have the Tag: Mod in them

DayZ_S_...txt - files are install/uninstall scripts for mods that are SERVER ONLY, that have a Tag: Server in them

DayZ_VarReset.txt - is called on creation and reinstall to initialize the variables needed.  Found that if you don't do this.. things get a little screwy

 

When a user runs a Workshop install/uninstall I call both the DayZ_CS and DayZ_S scripts (install or uninstall as needed).  Yes, they can be rolled into one, but makes for a long script and a pain in troubleshooting.  Will work on a combined script at some point!  The only caveat is that some authors/devs Tag their mods "Mod,Server" which is not good...  no real way around this as it is hard to tell what is a client/server mod and what is server only.

DayZ_CS_Install.txt DayZ_CS_Uninstall.txt DayZ_S_Install.txt DayZ_S_Uninstall.txt DayZ_VarReset.txt

Link to comment
Share on other sites

On 3/2/2020 at 12:27 PM, fjamieson said:

New scripts:

DayZ_CS_......txt files are install/ininstall scripts for mods that have the Tag: Mod in them

DayZ_S_...txt - files are install/uninstall scripts for mods that are SERVER ONLY, that have a Tag: Server in them

DayZ_VarReset.txt - is called on creation and reinstall to initialize the variables needed.  Found that if you don't do this.. things get a little screwy

 

When a user runs a Workshop install/uninstall I call both the DayZ_CS and DayZ_S scripts (install or uninstall as needed).  Yes, they can be rolled into one, but makes for a long script and a pain in troubleshooting.  Will work on a combined script at some point!  The only caveat is that some authors/devs Tag their mods "Mod,Server" which is not good...  no real way around this as it is hard to tell what is a client/server mod and what is server only.

DayZ_CS_Install.txt 2.48 kB · 0 downloads DayZ_CS_Uninstall.txt 3.23 kB · 0 downloads DayZ_S_Install.txt 2.49 kB · 0 downloads DayZ_S_Uninstall.txt 3.23 kB · 0 downloads DayZ_VarReset.txt 91 B · 0 downloads

So what Event is needed for DayZ_VarReset?

Link to comment
Share on other sites

  • 9 months later...
  • 2 months later...
  • 3 years later...
  • 9 months later...

Thougt I chime in here! Thanks for a great game server application software!
I ran into a few problems with installing and uninstalling scripts within TCAdmin with the DayZ Stand Alone Server on Linux. Not so much TCAdmin's fault 🙂
Current modders of DayZ have ways of doing things and not all modders are uniformed in the way they pack mods

i.e Capitalization, single quotes in file names and directory names can break Linux from executing commands. 

I took it upon myself to change a few lines of code in the Install and uninstall scripts for DayZ Stand Alone server.

It rewrites the folder names of the mod stripping out single quotes, double spaces, and commas in its name. 
It also allows for either "key" "Key" and "Keys" "keys" folders to properly be searched for key files and place them in your servers' "keys" folder.
A lot of modders change the name of this folder all the time hence the capitalization.

After Workshop Content Installed Script:

import clr
from System import Array, String
from System.IO import File, Path, Directory, SearchOption
import re

servertag="Server"
servermods=""
mods=""

y=[]
ModName=""

# Check for FileTitle
if len(FileTitle) != 0:
# Check FileTitle for special character
  for i in range(len(FileTitle)):
    if bool(re.search('[a-zA-Z0-9 \]\[_\'+-]', FileTitle[i])) : 
      y.append(FileTitle[i])
    else:
      y.append("")
         
    ModName= "".join(str(x) for x in y)
# Remove Single quote double spacing and single spacing in file name for linux compatibility
    ModName= ModName.Replace("  "," ").Replace(" ","_").Replace("'","")
    ModName= ModName.strip()
else:  
   ModName = FileId

if ThisService.Variables.HasValue("ServerMods") :
  servermods=ThisService.Variables["ServerMods"]
 
if ThisService.Variables.HasValue("Mods") :
  mods=ThisService.Variables["Mods"]
    
if Array.IndexOf(TagsArray, servertag) == -1 :
  ThisService.Variables["Mods"]=String.Format("@{0}", ModName) + ";" + mods    
else :
  ThisService.Variables["ServerMods"]=String.Format("@{0}", ModName) + ";" + servermods  
 
# Move folder to correct location
modfolder=Path.Combine(ThisService.RootDirectory, String.Format("@{0}", ModName))
if Directory.Exists(modfolder) :
  Directory.Delete(modfolder, True)
Directory.Move(InstallPath, modfolder)
 
# Move keys to root key folder
modkeys=Path.Combine(modfolder, "keys")
rootkeys=Path.Combine(ThisService.RootDirectory, "keys")
Directory.CreateDirectory(rootkeys)
if Directory.Exists(modkeys) :
  for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
    keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
    if File.Exists(keyfile) :
      File.Delete(keyfile)
    File.Move(file, keyfile)
 
# Move key to root key folder
modkeys=Path.Combine(modfolder, "key")
if Directory.Exists(modkeys) :
  for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
    keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
    if File.Exists(keyfile) :
      File.Delete(keyfile)
    File.Move(file, keyfile)
    
# Move key to root key folder for linux compatibility with modders using captitalization in folder name
modkeys=Path.Combine(modfolder, "Key")
if Directory.Exists(modkeys) :
  for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
    keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
    if File.Exists(keyfile) :
      File.Delete(keyfile)
    File.Move(file, keyfile)

# Move key to root key folder for linux compatibility with modders using captitalization in folder name
modkeys=Path.Combine(modfolder, "Keys")
if Directory.Exists(modkeys) :
  for file in Directory.GetFiles(modkeys, "*", SearchOption.AllDirectories):
    keyfile = Path.Combine(rootkeys, Path.GetFileName(file))
    if File.Exists(keyfile) :
      File.Delete(keyfile)
    File.Move(file, keyfile)
 
# Update command line
ThisService.Save()
ThisService.Configure()

After Workshop Content Uninstalled Script:

import clr
from System import Array, String
from System.IO import Path, Directory
import re

servermods=""
mods=""

y=[]
ModName=""

# Check for FileTitle
if len(FileTitle) != 0:
# Check FileTitle for special character
  for i in range(len(FileTitle)):
    if bool(re.search('[a-zA-Z0-9 \]\[_\'+-]', FileTitle[i])) : 
      y.append(FileTitle[i])
    else:
      y.append("")
         
    ModName= "".join(str(x) for x in y)
# Remove Single quote double spacing and single spacing in file name for linux compatibility
    ModName= ModName.Replace("  "," ").Replace(" ","_").Replace("'","") 
    ModName= ModName.strip()
else:  
   ModName = FileId
 
if ThisService.Variables.HasValue("ServerMods") :
  servermods=ThisService.Variables["ServerMods"]
 
if ThisService.Variables.HasValue("Mods") :
  mods=ThisService.Variables["Mods"]
   
ThisService.Variables["ServerMods"]=servermods.Replace(String.Format("@{0};", ModName), "")
ThisService.Variables["Mods"]=mods.Replace(String.Format("@{0};", ModName), "")
 
# Delete mod folder
modfolder=Path.Combine(ThisService.RootDirectory, String.Format("@{0}", ModName))
if Directory.Exists(modfolder) :
  Directory.Delete(modfolder, True)
 
# Update command line
ThisService.Save()
ThisService.Configure()

Hope this helps guys! Thanks!

Link to comment
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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Terms of Use