Actions
Name |
Path |
Arguments |
Working Directory |
Primary |
Play |
{InstallDir}\Alliance.EXE |
|
|
True |
Name Change Script
This script will patch the pilot file ($NewName0.plt) with the new name and rename it from the old name or copy a template pilot file in the install directory.
$NewPlayerAlias = $NewPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
$OldPlayerAlias = $OldPlayerAlias.Split([IO.Path]::GetInvalidFileNameChars()) -join '_'
if ($OldPlayerAlias.Length -gt 12) {
$OldPlayerAlias = $OldPlayerAlias.Substring(0, 12);
}
if ($NewPlayerAlias.Length -gt 12) {
$NewPlayerAlias = $NewPlayerAlias.Substring(0, 12);
}
if (Test-Path "$InstallDirectory\$($OldPlayerAlias)0.PLT") {
Rename-Item -Path "$InstallDirectory\$($OldPlayerAlias)0.PLT" -NewName "$InstallDirectory\$($NewPlayerAlias)0.PLT"
} else {
Copy-Item -Path "$InstallDirectory\TemplatePilot.PLT.example" -Destination "$InstallDirectory\$($NewPlayerAlias)0.PLT"
}
# Converts a string to a UTF16-encoded byte array. This looks like ASCII characters separated by 0x00 in most cases.
$bytes = ConvertTo-StringBytes -Input $NewPlayerAlias -MaxLength 12 -MinLength 12
Edit-PatchBinary -FilePath "$InstallDirectory\$($NewPlayerAlias)0" -Offset 0x00 -Data $bytes