Age of Mythology

From LANCommander
Revision as of 02:01, 6 January 2024 by DoctorDalek (talk | contribs) (Created new page for Age of Mythology)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Developers
Ensemble Studios
Publishers
MacSoft GamesMicrosoft Game Studios
Release Date
Windows: October 30, 2002
Genres
Real Time Strategy (RTS)Strategy
View at PCGamingWiki

Actions

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

Install Script

$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")
Copy-Item -Path "$InstallDirectory\Age of Mythology" -Destination "$DocumentsPath\My Games\Age of Mythology" -Recurse

# 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 '^xres=(.+)' -Substitution "xres=$($Display.Bounds.Width)" -FilePath "$InstallDirectory\startup\user.cfg"
Write-ReplaceContentInFile -Pattern '^yres=(.+)' -Substitution "yres=$($Display.Bounds.Height)" -FilePath "$InstallDirectory\startup\user.cfg"

Uninstall Script

$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")

Remove-Item -Path "$DocumentsPath\My Games\Age of Mythology" -Force -Recurse

Name Change Script

# Sanitize name as it will be used in a file name
$NewPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$Guid = [Guid]::NewGuid().ToString().ToUpper()

$DocumentsPath = [Environment]::GetFolderPath("MyDocuments")

Copy-Item -Path "$InstallDirectory\Age of Mythology\Users\Default.prf" -Destination "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"

# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '<profilename>(.*)</profilename>' -Substitution "<profilename>$NewPlayerAlias</profilename>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profilelanname>(.*)</profilelanname>' -Substitution "<profilelanname>$NewPlayerAlias</profilelanname>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '<profileguid>(.*)</profileguid>' -Substitution "<profileguid>{$Guid}</profileguid>" -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\$NewPlayerAlias.prf"
Write-ReplaceContentInFile -Pattern '^playerProfileName "(.+)"' -Substitution "playerProfileName ""$NewPlayerAlias""" -FilePath "$DocumentsPath\My Games\Age of Mythology\startup\persistent.cfg"
Write-ReplaceContentInFile -Pattern '^playerGUID "(.+)"' -Substitution "playerGUID ""{$Guid}""" -FilePath "$DocumentsPath\My Games\Age of Mythology\startup\persistent.cfg"

$NewPlayerAlias | Out-File -FilePath "$DocumentsPath\My Games\Age of Mythology\Users\LastProfile.txt"