Postal 2: Difference between revisions

From LANCommander
(Created page with "Category:Games {{Game.InfoBox |Cover = cover.jpg |Developers = {{Game.InfoBox.Developer|Running with Scissors}} |Publishers = {{Game.InfoBox.Publisher|Whiptail Interactive}} |Release Date = {{Game.InfoBox.ReleaseDate|Windows|April 13, 2003}} |Genres = {{Game.InfoBox.Genre|Adventure}} {{Game.InfoBox.Genre|Indie}} {{Game.InfoBox.Genre|Shooter}} | PCGamingWiki = Postal_2 }} {{Game.ActionBox |Actions = {{Game.ActionBox.Row|Name = Play (Singleplayer)|Path = System/Posta...")
 
No edit summary
Line 9: Line 9:
{{Game.InfoBox.ReleaseDate|Windows|April 13, 2003}}
{{Game.InfoBox.ReleaseDate|Windows|April 13, 2003}}
|Genres =
|Genres =
{{Game.InfoBox.Genre|Adventure}}
{{Game.InfoBox.Genre|Adventure}}{{Game.InfoBox.Genre|Indie}}{{Game.InfoBox.Genre|Shooter}}
{{Game.InfoBox.Genre|Indie}}
|PCGamingWiki = Postal_2}}
{{Game.InfoBox.Genre|Shooter}}
| PCGamingWiki = Postal_2
}}


{{Game.ActionBox
{{Game.ActionBox
|Actions =  
|Actions =  
{{Game.ActionBox.Row|Name = Play (Singleplayer)|Path = System/Postal2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play (Singleplayer)|Path = {InstallDir}\System/Postal2.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play (Multiplayer)|Path = ShareThePain/System/Postal2MP.exe|Arguments = |WorkingDirectory = |Primary = True}}
{{Game.ActionBox.Row|Name = Play (Multiplayer)|Path = {InstallDir}\ShareThePain/System/Postal2MP.exe|Arguments = |WorkingDirectory = |Primary = True}}
}}
}}


{{Game.Scripts.NameChange
 
|Name = Name Change Script
{{Game.Scripts.Install
|Name = Install Script
|Description =  
|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
 
$X = $Display.Bounds.Width
$Y = $Display.Bounds.Height
 
Write-ReplaceContentInFile -Pattern 'StartupFullscreen=(.+)' -Substitution "StartupFullscreen=True" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportX=(.+)' -Substitution "WindowedViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportY=(.+)' -Substitution "WindowedViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportX=(.+)' -Substitution "MenuViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportY=(.+)' -Substitution "MenuViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"


function Write-ReplaceContentInFile([string]$Regex, [string]$Replacement, [string]$FilePath)
Write-ReplaceContentInFile -Pattern 'StartupFullscreen=(.+)' -Substitution "StartupFullscreen=True" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
{
Write-ReplaceContentInFile -Pattern 'WindowedViewportX=(.+)' -Substitution "WindowedViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
    $content = (Get-Content $FilePath) -replace $Regex, $Replacement
Write-ReplaceContentInFile -Pattern 'WindowedViewportY=(.+)' -Substitution "WindowedViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
    [IO.File]::WriteAllLines($FilePath, $content)
Write-ReplaceContentInFile -Pattern 'FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
}
Write-ReplaceContentInFile -Pattern 'FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\Postal2MP\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportX=(.+)' -Substitution "MenuViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"


Write-ReplaceContentInFile -Regex 'Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'Name=(.+)' -Replacement "Name=$NewName" -FilePath "$InstallDir\ShareThePain\System\User.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}
 
           
{{Game.Scripts.Install
{{Game.Scripts.NameChange
|Name = Install Script
|Name = Name Change Script
|Description =  
|Description =  
|RequiresAdmin = False
|RequiresAdmin = False
|Contents = <syntaxhighlight lang="powershell" line>
|Contents =
$NewName = $args[0]
<syntaxhighlight lang="powershell" line>
$InstallDir = $PSScriptRoot
Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Add-Type -AssemblyName System.Windows.Forms
Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\User.ini"
$Display = [System.Windows.Forms.Screen]::AllScreens | Where-Object Primary | Select Bounds
Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
 
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 'StartupFullscreen=(.+)' -Replacement "StartupFullscreen=True" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'WindowedViewportX=(.+)' -Replacement "WindowedViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'WindowedViewportY=(.+)' -Replacement "WindowedViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'FullscreenViewportX=(.+)' -Replacement "FullscreenViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'FullscreenViewportY=(.+)' -Replacement "FullscreenViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'MenuViewportX=(.+)' -Replacement "MenuViewportX=$X" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Regex 'MenuViewportY=(.+)' -Replacement "MenuViewportY=$Y" -FilePath "$InstallDir\ShareThePain\System\Default.ini"
</syntaxhighlight>
</syntaxhighlight>
}}
}}

Revision as of 03:29, 6 January 2024

Developers
Running with Scissors
Publishers
Whiptail Interactive
Release Date
Windows: April 13, 2003
Genres
AdventureIndieShooter
View at PCGamingWiki

Actions

Name Path Arguments Working Directory Primary
Play (Singleplayer) {InstallDir}\System/Postal2.exe True
Play (Multiplayer) {InstallDir}\ShareThePain/System/Postal2MP.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 'StartupFullscreen=(.+)' -Substitution "StartupFullscreen=True" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportX=(.+)' -Substitution "WindowedViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportY=(.+)' -Substitution "WindowedViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportX=(.+)' -Substitution "MenuViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportY=(.+)' -Substitution "MenuViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"

Write-ReplaceContentInFile -Pattern 'StartupFullscreen=(.+)' -Substitution "StartupFullscreen=True" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportX=(.+)' -Substitution "WindowedViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'WindowedViewportY=(.+)' -Substitution "WindowedViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportX=(.+)' -Substitution "FullscreenViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'FullscreenViewportY=(.+)' -Substitution "FullscreenViewportY=$Y" -FilePath "$InstallDirectory\ShareThePain\Postal2MP\Postal2MP.ini"
Write-ReplaceContentInFile -Pattern 'MenuViewportX=(.+)' -Substitution "MenuViewportX=$X" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"

Name Change Script

Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\Default.ini"
Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\User.ini"
Write-ReplaceContentInFile -Pattern 'Name=(.+)' -Substitution "Name=$NewPlayerAlias" -FilePath "$InstallDirectory\ShareThePain\System\Postal2MP.ini"