Codename: Panzers - Phase One: Difference between revisions

From LANCommander
No edit summary
(Fixes to deprecated PowerShell scripts)
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:
{{Game.InfoBox
{{Game.InfoBox
|Cover = cover.jpg
|Cover = cover.jpg
|Developers =
|Publishers =
|Release Date =
|Release Date =
{{Game.InfoBox.ReleaseDate|Windows|September 30, 2004}}
{{Game.InfoBox.ReleaseDate|Windows|September 30, 2004}}
| PCGamingWiki = Codename:_Panzers_-_Phase_One
|Genres =
}}
 
|PCGamingWiki = Codename:_Panzers_-_Phase_One}}


== Actions ==
{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play|Path = |Arguments = |WorkingDirectory = |Primary = true}}
{{Game.ActionBox.Row|Name = Play|Path = {InstallDir}\PANZERS.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


== Saves ==
{{Game.SaveBox
|Paths =
{{Game.SaveBox.Row|Type = File|Path = }}
}}


{{Game.Scripts.NameChange
{{Game.Scripts.Install
|Name = Name Change Script
|Name = Install Script
|Description = The player name is stored in the options.ini file located in the game's install directory.
|Description =  
|RequiresAdmin = false
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
$X = $Display.Bounds.Width
{
$Y = $Display.Bounds.Height
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}


Write-ReplaceContentInFile -Regex '^Player name = (.+)' -Replacement "Player name = $NewName" -FilePath "$InstallDir\options.ini"
Write-ReplaceContentInFile -Pattern 'FullScreenWidth = (.+)' -Substitution "FullScreenWidth = $X" -FilePath "$InstallDirectory\options.ini"
Write-ReplaceContentInFile -Pattern 'FullScreenHeight = (.+)' -Substitution "FullScreenHeight = $Y" -FilePath "$InstallDirectory\options.ini"
Write-ReplaceContentInFile -Pattern 'FullScreen = (.+)' -Substitution "FullScreen = 1" -FilePath "$InstallDirectory\options.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}
 
           
{{Game.Scripts.Install
{{Game.Scripts.NameChange
|Name = Install Script
|Name = Name Change Script
|Description = The resolution for the game can be set in the options.ini file in the root of the game's install directory.
|Description =  
|RequiresAdmin = false
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
Write-ReplaceContentInFile -Pattern '^Player name = (.+)' -Substitution "Player name = $NewPlayerAlias" -FilePath "$InstallDirectory\options.ini"
 
Add-Type -AssemblyName System.Windows.Forms
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
 
function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
    [IO.File]::WriteAllLines($FilePath, $content)
}
 
$X = $Display.Width
$Y = $Display.Height
 
Write-ReplaceContentInFile -Regex 'FullScreenWidth = (.+)' -Replacement "FullScreenWidth = $X" -FilePath "$InstallDir\options.ini"
Write-ReplaceContentInFile -Regex 'FullScreenHeight = (.+)' -Replacement "FullScreenHeight = $Y" -FilePath "$InstallDir\options.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Latest revision as of 02:05, 6 January 2024

Release Date
Windows: September 30, 2004
View at PCGamingWiki

Actions

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

Install Script

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

$X = $Display.Bounds.Width
$Y = $Display.Bounds.Height

Write-ReplaceContentInFile -Pattern 'FullScreenWidth = (.+)' -Substitution "FullScreenWidth = $X" -FilePath "$InstallDirectory\options.ini"
Write-ReplaceContentInFile -Pattern 'FullScreenHeight = (.+)' -Substitution "FullScreenHeight = $Y" -FilePath "$InstallDirectory\options.ini"
Write-ReplaceContentInFile -Pattern 'FullScreen = (.+)' -Substitution "FullScreen = 1" -FilePath "$InstallDirectory\options.ini"

Name Change Script

Write-ReplaceContentInFile -Pattern '^Player name = (.+)' -Substitution "Player name = $NewPlayerAlias" -FilePath "$InstallDirectory\options.ini"