Descent

From LANCommander
Revision as of 02:08, 6 January 2024 by DoctorDalek (talk | contribs) (Created new page for Descent)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Parallax SoftwareInterplay Productions
Publishers
MacPlaySoftBankInterplay
Release Date
Windows: December 31, 1994
Genres
SimulatorShooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play {InstallDir}\d1x-retro-1.4.X6.exe True

Install Script

Sets the resolution of the game to the machine's current resolution.

# 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 '^ResolutionX=(.+)' -Substitution "ResolutionX=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\DESCENT.CFG"
Write-ReplaceContentInFile -Pattern '^ResolutionY=(.+)' -Substitution "ResolutionY=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\DESCENT.CFG"

Name Change Script

This script will take the old player's profile and rename it to the new name. If the old profile doesn't exist, a new one will be copied from "Template.<ext>.example". Finally, the last player variable in the config will be updated to the new name. Descent and modern ports require the name to be 8 characters and lowercased, so this script will handle that as well.

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

if ($OldPlayerAlias.Length -gt 8) {
    $OldPlayerAlias = $OldPlayerAlias.Substring(0, 8).ToLower();
}

if (Test-Path "$InstallDirectory\$OldPlayerAlias.plr") {
    Rename-Item -Path "$InstallDirectory\$OldPlayerAlias.plr" -NewName "$InstallDirectory\$NewPlayerAlias.plr"
}
else {
    Copy-Item -Path "$InstallDirectory\Template.plr.example" -Destination "$InstallDirectory\$NewPlayerAlias.plr"
}

if (Test-Path "$InstallDirectory\$OldPlayerAlias.plx") {
    Rename-Item -Path "$InstallDirectory\$OldPlayerAlias.plx" -NewName "$InstallDirectory\$NewPlayerAlias.plx"
}
else {
    Copy-Item -Path "$InstallDirectory\Template.plx.example" -Destination "$InstallDirectory\$NewPlayerAlias.plx"
}

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