Tutorials:Name Change Scripts

From LANCommander

Overview

Name change scripts are executed on the client's machine whenever they change their name from the Playnite extension or directly after the install script has executed. These scripts are dedicated solely to renaming a player's in-game name to ensure a consistency in multiplayer games.

There are a few guidelines that are recommended to follow when implementing a name change script for a game:

  • The script should only replace the current name and should not touch anything outside of the player's profile
  • Avoid leaving residual files on name changes. For instance, some games may have an entire file dedicated to a player's profile. This file should be renamed/altered to reflect the new name instead of a straight copy to a new profile.
  • Review the name change script variables for more information available during script execution
  • Many games have a limit on the amount of characters a player name can have. Make sure to trim or pad your player names if required. This is especially crucial for games that store the player name in a binary file. Read Tutorials:PowerShell_Cmdlets for helper cmdlets that may help in these scenarios.

Handling a name change primarily depends on how the game handles player saves. Game engines that store player names in plain text (e.g. Source, id Tech X, Unreal, etc.) are easily replaceable by using regular expressions (regex). Older games may have save files that need a binary patch. Others may just use a registry key.

Variables

When executing a name change script, the new name is available as a variable $NewPlayerAlias. The old name (not available when executed on install) is another variable that may be accessed using $OldPlayerAlias.

For a list of documented name change scripts, see Category:Games With Name Change Scripts.