Skip to content

Instantly share code, notes, and snippets.

@ayan4m1
Created March 1, 2017 20:34
Show Gist options
  • Save ayan4m1/c13da65dd3b0b45cd6a7cc929acc8141 to your computer and use it in GitHub Desktop.
Save ayan4m1/c13da65dd3b0b45cd6a7cc929acc8141 to your computer and use it in GitHub Desktop.
Looks in an ARK dedicated server install config for active mods and uses steamcmd to update them
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use Config::IniFiles;
use IO::CaptureOutput qw/capture/;
# Absolute path to steamcmd.sh/exe
my $steamPath = "C:\\Steam\\steamcmd";
# Absolute directory where ARK is (to be) installed
my $arkPath = "C:\\ark";
# ARK: Survival Evolved
my $gameAppId = 346110;
# ARK: Survival Evolved Dedicated Server
my $serverAppId = 376030;
# steamcmd commands
my %cmds = (
'login' => "+login anonymous",
'update' => "+app_update $serverAppId",
'update_mod' => "+workshop_download_item $gameAppId ",
'quit' => '+quit',
'set_install_dir' => "+force_install_dir \"$arkPath\""
);
system("$steamPath $cmds{login} $cmds{set_install_dir} $cmds{update} $cmds{quit}");
my $confPath = "$arkPath\\ShooterGame\\Saved\\Config\\WindowsServer\\GameUserSettings.ini";
die("$confPath does not exist") unless -e $confPath;
my $conf = Config::IniFiles->new(-file => $confPath);
my @confMods = split(',', $conf->val("ServerSettings", "ActiveMods"));
my $modCount = scalar @confMods;
print "updating $modCount mods\n";
my $modUpdateCmd = "$steamPath $cmds{login} $cmds{set_install_dir}";
foreach my $modId (@confMods) {
print "adding mod $modId\n";
$modUpdateCmd = "$modUpdateCmd $cmds{update_mod}$modId";
}
system("$modUpdateCmd $cmds{quit}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment