Soldat: 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|May 9, 2002}} |Genres = {{Game.InfoBox.Genre|Shooter}} {{Game.InfoBox.Genre|Indie}} | PCGamingWiki = Soldat }} {{Game.Scripts.NameChange |Name = Name Change Script |Description = |RequiresAdmin = False |Contents = <syntaxhighlight lang="powershell" li...")
 
No edit summary
 
Line 9: Line 9:
{{Game.InfoBox.ReleaseDate|Windows|May 9, 2002}}
{{Game.InfoBox.ReleaseDate|Windows|May 9, 2002}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Shooter}}
{{Game.InfoBox.Genre|Indie}}{{Game.InfoBox.Genre|Shooter}}
{{Game.InfoBox.Genre|Indie}}
|PCGamingWiki = Soldat}}
| PCGamingWiki = Soldat
 
{{Game.ActionBox
|Actions =
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\soldat.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


{{Game.Scripts.NameChange
{{Game.Scripts.NameChange
Line 18: Line 22:
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
 
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
# Trim a string down to a specified amount of characters
# Trim a string down to a specified amount of characters
if ($NewName.Length -gt 24) {
if ($NewPlayerAlias.Length -gt 24) {
     $NewName = $NewName.Substring(0, 24);
     $NewPlayerAlias = $NewPlayerAlias.Substring(0, 24);
}
}


# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Regex '^Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\soldat.ini"
Write-ReplaceContentInFile -Pattern '^Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\soldat.ini"
 
# TEST
# One
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 21:55, 8 January 2024

Developers
Transhuman Design
Publishers
Transhuman Design
Release Date
Windows: May 9, 2002
Genres
IndieShooter
View at PCGamingWiki

Actions

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

Name Change Script

# Trim a string down to a specified amount of characters
if ($NewPlayerAlias.Length -gt 24) {
    $NewPlayerAlias = $NewPlayerAlias.Substring(0, 24);
}

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\soldat.ini"