Codename: Panzers - Phase One: Difference between revisions

From LANCommander
No edit summary
No edit summary
Line 19: Line 19:
}}
}}


== Name Change Script ==
{{Game.Scripts.NameChange
The player name is stored in the options.ini file located in the game's install directory.
|Name = Name Change Script
<syntaxhighlight lang="powershell" line>
|Description = The player name is stored in the options.ini file located in the game's install directory.
|RequiresAdmin = false
|Contents = <syntaxhighlight lang="powershell" line>
$NewName = $args[0]
$NewName = $args[0]
$InstallDir = $PSScriptRoot
$InstallDir = $PSScriptRoot
Line 33: Line 35:
Write-ReplaceContentInFile -Regex '^Player name = (.+)' -Replacement "Player name = $NewName" -FilePath "$InstallDir\options.ini"
Write-ReplaceContentInFile -Regex '^Player name = (.+)' -Replacement "Player name = $NewName" -FilePath "$InstallDir\options.ini"
</syntaxhighlight>
</syntaxhighlight>
}}


== Install Script ==
{{Game.Scripts.Install
The resolution for the game can be set in the options.ini file in the root of the game's install directory.
|Name = Install Script
<syntaxhighlight lang="powershell" line>
|Description = The resolution for the game can be set in the options.ini file in the root of the game's install directory.
|RequiresAdmin = false
|Contents = <syntaxhighlight lang="powershell" line>
$NewName = $args[0]
$NewName = $args[0]
$InstallDir = $PSScriptRoot
$InstallDir = $PSScriptRoot
Line 55: Line 60:
Write-ReplaceContentInFile -Regex 'FullScreenHeight = (.+)' -Replacement "FullScreenHeight = $Y" -FilePath "$InstallDir\options.ini"
Write-ReplaceContentInFile -Regex 'FullScreenHeight = (.+)' -Replacement "FullScreenHeight = $Y" -FilePath "$InstallDir\options.ini"
</syntaxhighlight>
</syntaxhighlight>
}}

Revision as of 06:14, 31 July 2023

Release Date
Windows: September 30, 2004
View at PCGamingWiki

Actions

Actions

Name Path Arguments Working Directory Primary
Play true

Saves

Save Paths

Type Path
File

Name Change Script

The player name is stored in the options.ini file located in the game's install directory.

$NewName = $args[0]
$InstallDir = $PSScriptRoot

function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
{
    $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"

Install Script

The resolution for the game can be set in the options.ini file in the root of the game's install directory.

$NewName = $args[0]
$InstallDir = $PSScriptRoot

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"