DEFCON

From LANCommander
Revision as of 02:08, 6 January 2024 by DoctorDalek (talk | contribs)
Developers
Introversion Software
Publishers
Introversion Software
Release Date
Windows: September 29, 2006
Genres
IndieReal Time Strategy (RTS)Strategy
View at PCGamingWiki

Actions

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

Install Script

# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^ScreenWidth = "(.+)"' -Substitution "ScreenWidth $($Display.Bounds.Width)" -FilePath "$InstallDirectory\preferences.txt"
Write-ReplaceContentInFile -Pattern '^ScreenHeight = "(.+)"' -Substitution "ScreenHeight $($Display.Bounds.Height)" -FilePath "$InstallDirectory\preferences.txt"

Name Change Script

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

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