Soldat 2: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Transhuman Design}} |Publishers = {{Game.InfoBox.Publisher|Transhuman Design}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|September 22, 2020}} |Genres = {{Game.InfoBox.Genre|Shooter}} }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play|Path = soldat2.exe|Arguments = |WorkingDirectory = |Primary = True}} }} {{Game.Scripts.NameChange |Name = Name Change Script...")
 
No edit summary
 
Line 14: Line 14:
{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = soldat2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play|Path = soldat2.exe|Arguments = |WorkingDirectory = {InstallDir}|Primary = True}}
}}
}}


{{Game.Scripts.Install
|Name = Install Script
|Description =
|RequiresAdmin = False
|Contents =
<syntaxhighlight lang="powershell" line>
$Display = Get-PrimaryDisplay
Write-ReplaceContentInFile -Pattern '"Resolution": "(.+)",' -Substitution """Resolution"": ""$($Display.Bounds.Width)x$($Display.Bounds.Height)@60""," -FilePath "$InstallDirectory\client.json"
</syntaxhighlight>
}}
           
{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
|Name = Name Change Script
|Name = Name Change Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
 
Write-ReplaceContentInFile -Pattern '^PlayerName = (.+)' -Substitution "PlayerName = $NewPlayerAlias" -FilePath "$InstallDirectory\autoconfig.ini"
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Regex '^PlayerName = (.+)' -Replacement "PlayerName = $NewName" -FilePath "$InstallDir\autoconfig.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 00:49, 22 February 2024

Developers
Transhuman Design
Publishers
Transhuman Design
Release Date
Windows: September 22, 2020
Genres
Shooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play soldat2.exe {InstallDir} True

Install Script

$Display = Get-PrimaryDisplay

Write-ReplaceContentInFile -Pattern '"Resolution": "(.+)",' -Substitution """Resolution"": ""$($Display.Bounds.Width)x$($Display.Bounds.Height)@60""," -FilePath "$InstallDirectory\client.json"

Name Change Script

Write-ReplaceContentInFile -Pattern '^PlayerName = (.+)' -Substitution "PlayerName = $NewPlayerAlias" -FilePath "$InstallDirectory\autoconfig.ini"